MVC-free framework: IContextProvider, IArkAttachment, Application/Hosting split, NodaTime protobuf#742
MVC-free framework: IContextProvider, IArkAttachment, Application/Hosting split, NodaTime protobuf#742AndreaCuneo with Copilot wants to merge 7 commits into
Conversation
Co-authored-by: AndreaCuneo <5227688+AndreaCuneo@users.noreply.github.com>
…ple into build Co-authored-by: AndreaCuneo <5227688+AndreaCuneo@users.noreply.github.com>
…se IContextProvider and IArkAttachment Co-authored-by: AndreaCuneo <5227688+AndreaCuneo@users.noreply.github.com>
… layering, NodaTime protobuf; refresh lockfiles Co-authored-by: AndreaCuneo <5227688+AndreaCuneo@users.noreply.github.com>
AndreaCuneo
left a comment
There was a problem hiding this comment.
@copilot review all comments as if were for you.
apply changes to design, tasks, and current implementation. Then proceed with next step.
| ``` | ||
|
|
||
| Routing/metadata is expressed with attributes on the request type (e.g. | ||
| `[ArkEndpoint("POST", "/api/v1/orders")]`, `[ServiceGroup("Orders")]`, |
There was a problem hiding this comment.
use Http Endpoint and Grpc Method. make the transport declaration explicit.
| 2. **Semantic analysis** — resolves the symbol, response type, routing | ||
| attributes and parameter sources against the compilation's semantic model for | ||
| type safety. | ||
| 3. **Transport emission** — emits partial extension methods that wire the pure |
There was a problem hiding this comment.
make this "opt-in" so that in case the Framework is "limited" for a single Request/Query, the developer can manually implement the grpc method within the Service partial or the Map or the MessageHandler
| CreateOrderRequest request, HttpContext ctx, CancellationToken ctk) => | ||
| { | ||
| var container = ctx.RequestServices.GetRequiredService<SimpleInjector.Container>(); | ||
| await using var scope = AsyncScopedLifestyle.BeginScope(container); |
There was a problem hiding this comment.
scope is handled by simpleinjector integration in the pipeline. the scope is the entire request. other middlewares depends on the scope.
| `IHandleMessages<CreateOrderRequest>` whose `Handle` opens the SimpleInjector | ||
| scope (seeded from `MessageContext.Current.Headers`) and invokes the pure | ||
| handler. The message is the unit of work / transaction boundary via the Rebus | ||
| unit-of-work integration. |
There was a problem hiding this comment.
do not use Rebus.UnitOfWork
Rebus pipeline already has support for SimpleInjector scope
…e DI scope Co-authored-by: AndreaCuneo <5227688+AndreaCuneo@users.noreply.github.com>
Applied all four review points to design, tasks and the sample implementation in e8f6346:
Sample builds clean and all 5 self-tests pass. Next step is the code-first gRPC transport (T4.1), which is now opt-in-ready but requires the |
…versioning Co-authored-by: AndreaCuneo <5227688+AndreaCuneo@users.noreply.github.com>
| foreach (var segment in template.Split('/')) | ||
| { | ||
| if (segment.Length >= 2 | ||
| && (segment[0] == 'v' || segment[0] == 'V') | ||
| && segment.Skip(1).All(char.IsDigit)) | ||
| { | ||
| return "v" + segment.Substring(1); | ||
| } | ||
| } |
|
@copilot continue working on the next steps. review all documents before proceeding. |
Agent-Logs-Url: https://github.com/ARKlab/Ark.Tools/sessions/6797d97c-25a8-40fa-89cf-174bbbc785cb Co-authored-by: AndreaCuneo <5227688+AndreaCuneo@users.noreply.github.com>
Incorporates four prerequisite changes into the source-generated, MVC-free web-services work before continuing the remaining transport epics: adopt the existing identity/attachment abstractions, restructure the sample to match the ReferenceProject layering, and add NodaTime-over-protobuf support.
Identity:
IUserContext→IContextProvider<ClaimsPrincipal>IUserContext; handlers now consume the existingIContextProvider<ClaimsPrincipal>(Ex.GetUserId()).HostUserContextProviderreuses the shipped implementations:HttpContext.User(asAspNetCoreUserContextProviderdoes) for the HTTP path,RebusPrincipalContextWithFallbackProviderfor the bus path, with propagation viaAutomaticallyFlowUserContext/UserFlowStep.Ark.Tools.AspNetCorefrom the MVC-free sample.Attachments: generic
IProxyStream→IArkAttachmentIArkAttachment(Name,ContentType,OpenRead()) +ArkAttachment. Hosting mapsIFormFile→ArkAttachmentat a hand-written multipart endpoint; the pure handler streams it.Sample restructure (mirrors ReferenceProject)
…Sample.Application— transport-agnostic contracts/handlers/store/decorator.…Sample.WebInterface— composition root + startup; this is where selected requests/queries are exposed as endpoints and transports (user context, Rebus) are wired.…Sample.Api.[ArkEndpoint]cross-assembly, so hosting emits endpoints for contracts declared in Application. (ponytail:scans per-compilation; upgrade path = per-metadata-reference caching.)NodaTime over protobuf (
Ark.Tools.Nodatime.Protobuf)protobuf-net surrogates registered via
RuntimeTypeModel.AddNodaTimeSurrogates():OffsetDateTimeLocalDateLocalDateTimePeriodDocs
design.md,research.md,tasks.md,implementation-plan.md, sampleREADME.mdupdated for the new abstractions, the Application/Hosting split, and the NodaTime capability; T5.1, T6.2 and a new T4.4 marked accordingly.Notes for reviewers
Microsoft.CodeAnalysis.CSharpwas centralized earlier on this branch; 6 transitivepackages.lock.jsonfiles are regenerated (locked-mode restore).protobuf-netis the only added dependency (already sanctioned by the task).