Class TypeConverter
A factory for retrieving Functions capable of converting between two Types. To use custom Type conversions, inheritors should derive from this class and implement the GetUserDefinedFromDbConverter<TDatabase, TPoco>() and GetUserDefinedToDbConverter<TPoco, TDatabase>() methods.
Inherited Members
Namespace: Cassandra.Mapping.TypeConversion
Assembly: Cassandra.dll
Syntax
public abstract class TypeConverter
Constructors
TypeConverter()
Creates a new TypeConverter instance.
Declaration
protected TypeConverter()
Methods
GetUserDefinedFromDbConverter<TDatabase, TPoco>()
Gets any user defined conversion functions that can convert a value of type TDatabase
(coming from Cassandra) to a
type of TPoco
(a field or property on a POCO). Return null if no conversion Func is available.
Declaration
protected abstract Func<TDatabase, TPoco> GetUserDefinedFromDbConverter<TDatabase, TPoco>()
Returns
Type | Description |
---|---|
Func<TDatabase, TPoco> | A Func that can convert between the two types or null if one is not available. |
Type Parameters
Name | Description |
---|---|
TDatabase | The Type of the source value from Cassandra to be converted. |
TPoco | The Type of the destination value on the POCO. |
GetUserDefinedToDbConverter<TPoco, TDatabase>()
Gets any user defined conversion functions that can convert a value of type TPoco
(coming from a property/field on a
POCO) to a type of TDatabase
(the Type expected by Cassandra for the database column). Return null if no conversion
Func is available.
Declaration
protected abstract Func<TPoco, TDatabase> GetUserDefinedToDbConverter<TPoco, TDatabase>()
Returns
Type | Description |
---|---|
Func<TPoco, TDatabase> | A Func that can converter between the two Types or null if one is not available. |
Type Parameters
Name | Description |
---|---|
TPoco | The Type of the source value from the POCO property/field to be converted. |
TDatabase | The Type expected by C* for the database column. |