ToNullStringAttribute ..
Used to mutate the a string to null when its value is empty or whitespace.
Namespace: Dado.ComponentModel.DataMutations
Implements: Dado.ComponentModel.DataMutations.MutationAttribute (in Dado.ComponentModel.Mutations)
[AttributeUsage(AttributeTargets.Property)]
public class ToNullStringAttribute : MutationAttribute
Name | Description |
---|---|
Priority | Gets or sets a value indicating the priority that determines the order in which MutationAttributes are evaluated. |
RequiresContext | A flag indicating the attribute requires a non-null MutationContext<T> to perform validation. |
Name | Description |
---|---|
Mutate(Object, IMutationContext) | Mutates the given value according to this MutationAttribute. |
MutateValue(Object, IMutationContext) | Implements the mutation logic for this ToNullStringAttribute. |
Gets or sets a value indicating the priority that determines the order in which MutationAttributes are evaluated. Defaults to 30
.
public override int Priority { get; set; } = 30;
- Type
- System.Int32
Implements the mutation logic for this ToNullStringAttribute.
protected override object MutateValue(
object value,
IMutationContext context
)
null when the value
is empty or whitespace, otherwise the specified value
.
- value
- Type: System.Object
The value to mutate. - context
- Type: Dado.ComponentModel.DataMutations.IMutationContext
Describes thevalue
being mutated and provides services and context for mutation.