SmartExchange · .NET 10 · Chapter 02
Packages and boundaries
Four .NET 10 libraries currently live in MicroApps. They are the shared code to publish as NuGet packages for both consumers.
Current projects → shared packages
| Project | Classes and interfaces | Responsibility |
|---|---|---|
BmcGroup.Authorization.Contracts | AuthorizationGrant, AuthorizationPrincipal, request/resource/plan records; IAuthorizationGrantReader, IAuthorizationContextResolver, IAuthorizationPolicyClient; expression records. | Stable contracts independent of Cerbos transport and SQL. Four source files. |
BmcGroup.Authorization.SmartExchange | LegacySqlAuthorizationGrantAdapter, SmartExchangeAuthorizationContextResolver, SmartExchangeAuthorizationRelationshipRegistry, SmartExchangeAuthorizationScopeValidator. | SmartExchange grant facts, scope normalization/validation and CRM relationship metadata. |
BmcGroup.Authorization.Cerbos | CerbosAuthorizationPolicyClient, CerbosQueryPlanMapper, AuthorizationOptions, CerbosAuthorizationOptions. | Reusable gRPC connection, PlanResources request and response mapping. |
BmcGroup.Authorization.SqlKata | IAuthorizationQueryAdapter, SqlKataAuthorizationQueryAdapter, AuthorizationSqlMappingFactory; SQL mapping/value/relationship records. | Translate the supported plan into a parameterized query using trusted mappings. |
BmcGroup.CRM and BmcGroup.CRM.Diagram already belong to the NuGet solution. They provide entity annotations and generated metadata to SmartExchange authorization.
PackageReference, never a cross-solution reference to a NuGet source project.What stays in each application
| Intaker · MicroApps | Web API · its own solution |
|---|---|
MicroApplication.OnInitialization(): create the client from configuration. | Configure the same client with the same connection contract. |
OnMessageAxtionExportXlsx: user/product, template and export workflow. | Endpoint: authenticated user/product, action and entity query. |
ExportAuthorizationResourceCatalog.GetMapping() and ExportQueryBuilder.ApplyAuthorizationPlan(). | Supply API query aliases/mappings and call the shared SQL adapter before count/paging. |
Web API will use the same four authorization packages plus matching CRM metadata dependencies. SqlKata is reusable outside Intaker. A different query technology would need another enforcement adapter; grant resolution and Cerbos planning remain shared.
Delivery boundary
Move the shared libraries into the NuGet solution → publish a compatible package set → switch Intaker to package references → integrate Web API. Neither ExportQueryBuilder nor template/plugin processing moves into the shared authorization layer.
Same packages for both exports
| Shared call | Person export | InterestedParty export |
|---|---|---|
ResolveAsync() | Person + Company grants | InterestedParty + Project + Investor grants |
PlanResourcesAsync() | Person / export | InterestedParty / export |
GetRelationships() + Create() | companyIds → PersonInCompany → Company | projectIds → Project |
Apply() | Append Company EXISTS | Append Project EXISTS |
These are configuration/data differences, not two separate authorization implementations. Both documentation policies and their requests are clearly separated from the deployed default version.