MutationAttribute ..
Base class for all mutation attributes.
Namespace: Dado.ComponentModel.DataMutations
Implements: System.Attribute (in System)
public abstract class MutationAttribute : Attribute
Name | Description |
---|---|
Priority | Gets or sets a value indicating the priority that determines the order in which MutationAttributes are evaluated. |
RequiresContext | Gets or sets a value indicating whether the attribute requires a non-null IMutationContext to perform validation. |
Name | Description |
---|---|
Mutate(Object, IMutationContext) | Mutates the given value according to this MutationAttribute. |
MutateValue(Object, IMutationContext) | A protected method to override and implement mutation logic. |
Gets or sets a value indicating the priority that determines the order in which MutationAttributes are evaluated. Base class defaults to 10
. Override in child classes as appropriate.
public virtual int Priority { get; set; } = 10;
- Type
- System.Int32
Gets or sets a value indicating whether the attribute requires a non-null IMutationContext to perform validation. Base class returns false
. Override in child classes as appropriate.
public virtual bool RequiresContext { get; }
- Type
- System.Boolean
Mutates the given value according to this MutationAttribute.
public object Mutate(
object value,
IMutationContext context = null
)
The resulting mutated 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.
Exception | Condition |
---|---|
System.ArgumentNullException | When context is required and null. |
A protected method to override and implement mutation logic.
protected abstract object MutateValue(
object value,
IMutationContext context
)
The resulting mutated 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.