Class ValueObjectInputOptions
Namespace: AdCodicem.ValueObjects.Blazor
Assembly: AdCodicem.ValueObjects.Blazor.dll
The messages the inputs of value objects answer a refusal with: the English message of the rule, or one read from a resource of the application, under the key of the rule's code.
public sealed class ValueObjectInputOptions
Inheritance
object ← ValueObjectInputOptions
Inherited Members
object.Equals(object?), object.Equals(object?, object?), object.GetHashCode(), object.GetType(), object.ReferenceEquals(object?, object?), object.ToString()
Remarks
The options of AddValueObjectInputs(options => …). Without a resource, a refusal keeps the English message of
the rule. With one, the message is looked up under the keys of ValueObject.value_object.too_short, after the same key followed by .minimum or .maximum
for a range of one bound. It is formatted with the input's DisplayName, or else the name of its field, as
{0}, followed by the arguments {1}. A key with no entry keeps the English message.
The current UI culture chooses the resource, and the current culture formats the arguments: the culture a Blazor
Server circuit or a Blazor WebAssembly application runs in. The localizer comes from the application's services,
which AddValueObjectInputs registers with AddLocalization(), keeping a registration the application made
first. A template quoting an argument its code does not supply is the application's error, and its
Properties
ResourceType
Gets the type whose resources hold the messages, or null to keep the English messages.
public Type? ResourceType { get; }
Property Value
Type?
Methods
UseResource<TResource>()
Reads the messages from the resources of TResource, under the key of the rule's code.
public ValueObjectInputOptions UseResource<TResource>()
Returns
These options, so calls can be chained.
Type Parameters
TResource
The type the resources are named after, as IStringLocalizer<T> names them: an empty class of the
application, beside a .resx file of the same name for each culture.
UseResource(Type)
Reads the messages from the resources of a type.
public ValueObjectInputOptions UseResource(Type resourceType)
Parameters
resourceType Type
The type the resources are named after.
Returns
These options, so calls can be chained.
Exceptions
resourceType is null.