Repository navigation
Release v22.144.0
Commands and queries now know which module, feature and slice they belong to, on the backend and in the generated TypeScript proxies, so error handling, diagnostics and support tooling can say where something happened without extra configuration.
Added
SliceLocationinCratis.Arc.Slices, a record ofModuleName,FeatureNameandSliceNameresolved from the same namespace mapping that places generated proxies (NamespaceRootitems andCratisProxiesSegmentsToSkip).SliceLocation.For(type)resolves any type, andToString()givesBilling/Invoices/Pay. See Slice location. (#3533)CommandContext.SliceLocationandQueryContext.SliceLocationhold the location of the executing command or query, for model-bound and controller-based commands and queries alike.- The Arc build emits
[assembly: SliceNamespaceRoot(...)]and[assembly: SliceNamespaceSegmentsToSkip(...)]from the project's proxy configuration, so the runtime reads the same values the proxy generator does. Projects that do not build with the Arc MSBuild targets can declare the attributes themselves. - Generated command and query proxies declare a
static readonly sliceLocation, importing Arc's type under theArcSliceLocationalias so an application type namedSliceLocationdoes not clash. SliceLocationin@cratis/arc/reflection, withSliceLocation.of(instance)andSliceLocation.ofType(type)to read the location of a proxy, returningSliceLocation.emptywhen none is declared.
Changed
- The slice location strips the
Cratis.APInamespace prefix exactly like the proxy output folder does, so the folder and the location never differ. - Upgrade
@cratis/arcto the version matching the Arc NuGet packages before regenerating proxies: regenerated proxies importSliceLocationfrom@cratis/arc/reflectionand do not compile against an older@cratis/arc. Proxies generated by an earlier version reportSliceLocation.emptyuntil regenerated.