Class ValueObjectDapper
Namespace: AdCodicem.ValueObjects.Dapper
Assembly: AdCodicem.ValueObjects.Dapper.dll
Registers Dapper type handlers for value objects.
public static class ValueObjectDapper
Inheritance
Inherited Members
object.Equals(object?), object.Equals(object?, object?), object.GetHashCode(), object.GetType(), object.MemberwiseClone(), object.ReferenceEquals(object?, object?), object.ToString()
Remarks
Dapper keeps its handlers in a process-wide table, so this is called once at start-up. Without it, every query touching a value object would need an explicit projection.
Methods
AddValueObjectHandler<TSelf, TValue>()
Registers a handler for one value object, such as a construction of a generic value object.
public static void AddValueObjectHandler<TSelf, TValue>() where TSelf : struct, IValueObject<TSelf, TValue>
Type Parameters
TSelf
Value object type, Code<Order> for instance.
TValue
Underlying value type.
Remarks
The handler is the one
Exceptions
TValue is
AddValueObjectHandlers(params Assembly[])
Registers a handler for every value object declared in the given assemblies.
[RequiresUnreferencedCode("Closes the generic type handler over each value object type.")]
[RequiresDynamicCode("Closes the generic type handler over each value object type.")]
public static void AddValueObjectHandlers(params Assembly[] assemblies)
Parameters
assemblies Assembly[]
Assemblies declaring the value objects. When none is given, everything already registered is handled.
Remarks
A value object Dapper already has a handler for keeps it, whoever registered it, so calling this again
changes nothing and a handler of the application's own is not replaced. Which types are handled is read
from Dapper's table rather than remembered here, so a call after
A value object over
A generic value object has no handler until its constructions are known, and Dapper looks a handler up by the
exact type, ahead of any query: register each construction with