Cratis Arc setup for ASP.NET Core
Cratis Arc integrates command and query execution with ASP.NET Core, so you can use Arc alongside the host’s middleware, MVC controllers, and authentication. Install Cratis.Arc, register it with WebApplicationBuilder.AddCratisArc(), and activate it with WebApplication.UseCratisArc(). No event store is required.
Start with configuration for host settings. Before exposing private operations, configure an authentication scheme and authorization requirements; adding Arc does not make every endpoint private. OpenAPI and Swagger support come in separate optional packages.
Features
Section titled “Features”- Configuration: set Arc options in appsettings.json or code.
- Authorization: protect HTTP endpoints and Arc pipeline calls at their respective boundaries.
- Microsoft Identity: authenticate forwarded principals behind a trusted ingress.
- Acting on behalf of a user: authorize as the represented user while retaining the actor for audit.
- FromRequest Attribute: combine JSON, route, and query values in one MVC input model.
- Swagger: describe Arc endpoints and check schema limits before generating clients.
- Validation: validate input with FluentValidation.
- Without Wrappers: choose which endpoints return unwrapped responses.
- Invariant Culture: give culture-sensitive parsing and formatting consistent defaults.
When to Use ASP.NET Core Integration
Section titled “When to Use ASP.NET Core Integration”Choose this host when your application needs ASP.NET Core’s middleware ecosystem, Kestrel, MVC or Razor, or static-file serving. It is also the host for Arc’s Swagger UI integration. You can keep those web concerns in ASP.NET Core while Arc handles commands and queries.
When to Use Arc.Core Instead
Section titled “When to Use Arc.Core Instead”Use Arc.Core without ASP.NET Core when you want Arc’s command and query pipelines in a console application, background service, or its own HttpListener host. You do not get the ASP.NET middleware ecosystem with that host. Check performance and Native AOT compatibility with your actual deployment dependencies before choosing on those grounds.
See Also
Section titled “See Also”- Arc.Core Overview - Lightweight alternative without ASP.NET Core
- Commands - Command handling patterns
- Queries - Query patterns and conventions
- Tenancy - Tenant isolation and management