Skip to main content

Class ValueObjectConverter<TSelf, TValue>

Namespace: AdCodicem.ValueObjects.EntityFrameworkCore
Assembly: AdCodicem.ValueObjects.EntityFrameworkCore.dll

Stores a value object as its bare underlying value.

public sealed class ValueObjectConverter<TSelf, TValue> : ValueConverter<TSelf, TValue> where TSelf : struct, IValueObject<TSelf, TValue>

Type Parameters

TSelf

Value object type.

TValue

Underlying value type.

Inheritance

objectValueConverterValueConverter<TSelf, TValue>ValueObjectConverter<TSelf, TValue>

Inherited Members

ValueConverter<TSelf, TValue>.ConvertToProvider, ValueConverter<TSelf, TValue>.ConvertFromProvider, ValueConverter<TSelf, TValue>.ConvertToProviderTyped, ValueConverter<TSelf, TValue>.ConvertFromProviderTyped, ValueConverter<TSelf, TValue>.ConvertToProviderExpression, ValueConverter<TSelf, TValue>.ConvertFromProviderExpression, ValueConverter<TSelf, TValue>.ModelClrType, ValueConverter<TSelf, TValue>.ProviderClrType, ValueConverter<TSelf, TValue>.ConstructorExpression, ValueConverter.ComposeWith(ValueConverter?), ValueConverter.ConvertToProvider, ValueConverter.ConvertFromProvider, ValueConverter.ConvertToProviderExpression, ValueConverter.ConvertFromProviderExpression, ValueConverter.ModelClrType, ValueConverter.ProviderClrType, ValueConverter.MappingHints, ValueConverter.ConvertsNulls, ValueConverter.ConstructorExpression, object.Equals(object?), object.Equals(object?, object?), object.GetHashCode(), object.GetType(), object.ReferenceEquals(object?, object?), object.ToString()

Remarks

Reading uses the trusted factory: no normalization, no validation, no allocation beyond the value itself. Materializing an entity is the hottest path in most applications, and the rows being read were written by this same application through the validating factory. Use when the table is also written to by something else.

Both directions go through static helpers rather than inline lambdas, because an expression tree cannot contain a call to a static abstract interface member.

Constructors

ValueObjectConverter()

Initializes a new instance of the class.

public ValueObjectConverter()