Class TenancyOptionsValidator
- Namespace
- Cratis.Arc.Tenancy
- Assembly
- Cratis.Arc.Core.dll
Represents an implementation of IValidateOptions<TOptions> that refuses a tenancy configuration no request could resolve a tenant from.
public class TenancyOptionsValidator : IValidateOptions<ArcOptions>
- Inheritance
-
TenancyOptionsValidator
- Implements
- Inherited Members
- Extension Methods
Remarks
The tenant resolver is created by a factory the first time something asks for it, and a factory registration is
not something the service provider can check when it is built. Without this the misconfiguration would surface on
the first request instead - after the process has reported itself started and healthy, with a real user waiting on
the failure. Arc registers ArcOptions with ValidateOnStart, so this runs while the host is
starting and stops it there.
It throws BaseDomainIsNotADomainName rather than returning a failed
ValidateOptionsResult, because that is the exception UseSubdomainTenancy and the resolver
already throw for the same configuration, and it says what is wrong and how to fix it. A failure result would be
collected into a generic options exception and read as one more validation message.
Constructors
TenancyOptionsValidator()
public TenancyOptionsValidator()
Methods
Validate(string?, ArcOptions)
Validates the tenancy configuration.
public ValidateOptionsResult Validate(string? name, ArcOptions options)
Parameters
namestringThe name of the options instance being validated.
optionsArcOptionsThe ArcOptions to validate.
Returns
- ValidateOptionsResult
The ValidateOptionsResult of the validation.
Exceptions
- BaseDomainIsNotADomainName
Thrown when subdomain tenancy is configured with a base domain no host could be matched against.