Class ValueObjectTypeHandler<TSelf, TValue>
Namespace: AdCodicem.ValueObjects.Dapper
Assembly: AdCodicem.ValueObjects.Dapper.dll
Maps a value object to and from its underlying column value for Dapper.
public sealed class ValueObjectTypeHandler<TSelf, TValue> : SqlMapper.TypeHandler<TSelf>, SqlMapper.ITypeHandler where TSelf : struct, IValueObject<TSelf, TValue>
Type Parameters
TSelf
Value object type.
TValue
Underlying value type.
Inheritance
object ← SqlMapper.TypeHandler<TSelf> ← ValueObjectTypeHandler<TSelf, TValue>
Implements
SqlMapper.ITypeHandler
Inherited Members
SqlMapper.TypeHandler<TSelf>.SetValue(IDbDataParameter, TSelf), SqlMapper.TypeHandler<TSelf>.Parse(object), object.Equals(object?), object.Equals(object?, object?), object.GetHashCode(), object.GetType(), object.ReferenceEquals(object?, object?), object.ToString()
Remarks
Reading uses the trusted factory, on the same reasoning as the Entity Framework Core converter: the rows come from a database this application wrote through the validating factory, and read paths are hot.
Methods
Parse(object)
Parse a database value back to a typed value
public override TSelf Parse(object value)
Parameters
value object
The value from the database
Returns
TSelf
The typed value
SetValue(IDbDataParameter, TSelf)
Assign the value of a parameter before a command executes
public override void SetValue(IDbDataParameter parameter, TSelf value)
Parameters
parameter IDbDataParameter
The parameter to configure
value TSelf
Parameter value