Table of Contents

Interface IComplexTypeConverter

Namespace
MASES.EntityFrameworkCore.KNet.Serialization
Assembly
MASES.EntityFrameworkCore.KNet.Serialization.dll

The interface shall be implemented and used from any external converter which neeeds to interact with serialization sub-system to manage IComplexProperty

public interface IComplexTypeConverter : IComplexTypeConverterLogging
Inherited Members

Remarks

The implementation of Convert(PreferredConversionType, ref object?) and ConvertBack(PreferredConversionType, ref object?) shall be thread-safe and the class shall have at least a default initializer

Properties

SupportedClrTypes

The set of Type supported from the converter

IEnumerable<Type> SupportedClrTypes { get; }

Property Value

IEnumerable<Type>

Methods

Convert(PreferredConversionType, ref object?)

The method is used from constructor of IValueContainer<T> to manage IComplexProperty that does not have an autonomous conversion

bool Convert(PreferredConversionType conversionType, ref object? data)

Parameters

conversionType PreferredConversionType

The preferred conversion can be applied, however the IComplexTypeConverter can decide autonomously

data object

The input data coming from EF Core to be converted, the converted value shall return on the same reference

Returns

bool

true if the IComplexTypeConverter has converted the data, if it not able to execute the conversion, or want to leave the management to the subsystem, shall return false

Remarks

The DefaultValueContainer<TKey> by default uses POCO serialization so it does not need to implement the method and can return false.

ConvertBack(PreferredConversionType, ref object?)

The method is used from GetData(IValueContainerMetadata, ref object[], IComplexTypeConverterFactory?) and GetProperties(IEntityType?) to manage IComplexProperty that does not have an autonomous conversion

bool ConvertBack(PreferredConversionType conversionType, ref object? data)

Parameters

conversionType PreferredConversionType

The preferred conversion can be applied, however the IComplexTypeConverter can decide autonomously

data object

The input data coming from serialization to be converted back, the converted value shall return on the same reference

Returns

bool

true if the IComplexTypeConverter has converted the data, if it not able to execute the conversion shall return false

Remarks

The DefaultValueContainer<TKey> by default uses POCO serialization so it does not need to implement the method and can return false.