Class ArcOptions

Namespace
Cratis.Arc
Assembly
Cratis.Arc.Core.dll

Represents the options for Arc.

public class ArcOptions
Inheritance
ArcOptions
Inherited Members
Extension Methods

Constructors

ArcOptions()

Initializes a new instance of the ArcOptions class.

public ArcOptions()

Properties

ConnectionResolution

Gets or sets how storage connections are resolved, for every storage integration that has no resolution of its own.

public ConnectionResolutionOptions ConnectionResolution { get; set; }

Property Value

ConnectionResolutionOptions

Remarks

Configure it once here and both MongoDB and Entity Framework Core resolve through it. An integration's own connection resolution takes precedence when it is configured.

CorrelationId

Gets or sets the options for the correlation ID.

public CorrelationIdOptions CorrelationId { get; set; }

Property Value

CorrelationIdOptions

ExposeExceptionDetails

Gets or sets a value indicating whether exception detail (messages and stack traces) is exposed to clients in serialized CommandResult and QueryResult responses.

public bool ExposeExceptionDetails { get; set; }

Property Value

bool

Remarks

Defaults to true only in the Development environment and false otherwise. When false, exception messages and stack traces are redacted from responses (the full detail is still logged server-side and the correlation identifier is retained) to avoid leaking internal information.

GeneratedApis

Gets or sets the options for generated API endpoints (commands and queries).

public ApiEndpointOptions GeneratedApis { get; set; }

Property Value

ApiEndpointOptions

Hosting

Gets or sets the hosting options for Arc, only used by Arc.Core.

public HostingOptions Hosting { get; set; }

Property Value

HostingOptions

IdentityDetailsProvider

Gets or sets what type of identity details provider to use. If none is specified it will use type discovery to try to find one.

public Type? IdentityDetailsProvider { get; set; }

Property Value

Type

Introspection

Gets or sets the exposure options for command and query introspection.

public IntrospectionOptions Introspection { get; set; }

Property Value

IntrospectionOptions

JsonSerializerOptions

Gets the JsonSerializerOptions configured for Arc.

public JsonSerializerOptions JsonSerializerOptions { get; }

Property Value

JsonSerializerOptions

Query

Gets or sets the options for observable queries.

public QueryOptions Query { get; set; }

Property Value

QueryOptions

QueryHealth

Gets or sets the access options for the query health diagnostic feed.

public QueryHealthOptions QueryHealth { get; set; }

Property Value

QueryHealthOptions

Tenancy

Gets or sets the options for the tenancy.

public TenancyOptions Tenancy { get; set; }

Property Value

TenancyOptions

TrustForwardedIdentityHeaders

Gets or sets a value indicating whether the host trusts the Microsoft Identity Platform identity headers (x-ms-client-principal, x-ms-client-principal-id and x-ms-client-principal-name) that a trusted ingress forwards. Defaults to false.

public bool TrustForwardedIdentityHeaders { get; set; }

Property Value

bool

Remarks

These headers are not signed: anyone who can reach the application directly can set them. Arc therefore ignores them, and treats the request as anonymous, unless the host opts in. Enable this only when every request reaches the application through an ingress that strips client-supplied identity headers and sets its own, such as Azure App Service or Container Apps authentication (EasyAuth) or Cratis AuthProxy.

Bound from Cratis:Arc:TrustForwardedIdentityHeaders. The obsolete Cratis:Arc:Introspection:TrustForwardedIdentityHeaders setting also turns it on.

Methods

AddJsonTypeInfoResolver(IJsonTypeInfoResolver)

Add a type info resolver, typically the application's source-generated JsonSerializerContext, to the JsonSerializerOptions Arc serializes with.

public ArcOptions AddJsonTypeInfoResolver(IJsonTypeInfoResolver resolver)

Parameters

resolver IJsonTypeInfoResolver

The IJsonTypeInfoResolver to add, for instance MyJsonSerializerContext.Default.

Returns

ArcOptions

The ArcOptions for continuation.

Remarks

Resolvers added here are consulted first, so the application's contracts - including any it customizes for Arc's own types - win. That holds even after the application has wrapped JsonSerializerOptions's TypeInfoResolver, for instance with WithAddedModifier, or cleared it: the resolver then goes ahead of the wrapper, or ahead of Arc's resolver composed anew. Resolvers added while Arc's resolver is still in the chain are consulted in the order they were added; once the resolver has been wrapped, a resolver added later is consulted before earlier ones. Resolvers appended to JsonSerializerOptions's TypeInfoResolverChain come next, then Arc's source-generated metadata for its own wire types, and the reflection-based resolver comes last, only when reflection-based serialization is enabled. That lets an application that is trimmed or compiled with NativeAOT, where reflection is disabled, serialize its read models, query arguments and command responses through generated metadata. A command response is written as CommandResult<TResponse>, which Arc's metadata cannot cover, so the application's context has to include CommandResult<TResponse> for each response type.

Add resolvers while configuring Arc, before the first serialization: JsonSerializerOptions become read-only once used.