Skip to content
This repository has been archived by the owner on Sep 5, 2024. It is now read-only.

Latest commit

 

History

History
124 lines (82 loc) · 2.96 KB

File metadata and controls

124 lines (82 loc) · 2.96 KB

MutationAttribute ..

Base class for all mutation attributes.

Namespace: Dado.ComponentModel.DataMutations
Implements: System.Attribute (in System)

Syntax

public abstract class MutationAttribute : Attribute

Properties

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.

Methods

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.

Priority

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.

Syntax

public virtual int Priority { get; set; } = 10;
Type
System.Int32

RequiresContext

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.

Syntax

public virtual bool RequiresContext { get; }
Type
System.Boolean

Mutate(Object, IMutationContext)

Mutates the given value according to this MutationAttribute.

Syntax

public object Mutate(
	object value,
	IMutationContext context = null
)

Returns

The resulting mutated value.

Parameters

value
Type: System.Object
The value to mutate.
context
Type: Dado.ComponentModel.DataMutations.IMutationContext
Describes the value being mutated and provides services and context for mutation.

Exceptions

Exception Condition
System.ArgumentNullException When context is required and null.

MutateValue(Object, IMutationContext)

A protected method to override and implement mutation logic.

Syntax

protected abstract object MutateValue(
	object value,
	IMutationContext context
)

Returns

The resulting mutated value.

Parameters

value
Type: System.Object
The value to mutate.
context
Type: Dado.ComponentModel.DataMutations.IMutationContext
Describes the value being mutated and provides services and context for mutation.