RelationalTypeMapper RelationalTypeMapper Class

Definition

Maps .NET types to their corresponding relational database types.

This type is typically used by database providers (and other extensions). It is generally not used in application code.

public abstract class RelationalTypeMapper : IRelationalTypeMapper
Public MustInherit Class RelationalTypeMapper
    Implements IRelationalTypeMapper
Inheritance
System.ObjectSystem.Object
RelationalTypeMapperRelationalTypeMapper
Implements

Properties

ByteArrayMapper ByteArrayMapper

Gets the mapper to be used for byte array properties.

public virtual IByteArrayRelationalTypeMapper ByteArrayMapper { get; }
Public Overridable ReadOnly Property ByteArrayMapper As IByteArrayRelationalTypeMapper

StringMapper StringMapper

Gets the mapper to be used for string properties.

public virtual IStringRelationalTypeMapper StringMapper { get; }
Public Overridable ReadOnly Property StringMapper As IStringRelationalTypeMapper

Methods

CreateMappingFromStoreType(String) CreateMappingFromStoreType(String)

Creates the mapping for the given database type.

protected virtual RelationalTypeMapping CreateMappingFromStoreType(string storeType)
Protected Overridable Function CreateMappingFromStoreType(storeType As String) As RelationalTypeMapping
Parameters
storeType
System.String System.String

The type to create the mapping for.

Returns

The type mapping to be used.

Equals(Object) Equals(Object)

Inherited from System.Object

Equals(Object, Object) Equals(Object, Object)

Inherited from System.Object

FindCustomMapping(IProperty) FindCustomMapping(IProperty)

Gets the relational database type for the given property, using a separate type mapper if needed. This base implementation uses custom mappers for string and byte array properties. Returns null if no mapping is found.

protected virtual RelationalTypeMapping FindCustomMapping(IProperty property)
Protected Overridable Function FindCustomMapping(property As IProperty) As RelationalTypeMapping
Parameters
property
IProperty IProperty

The property to get the mapping for.

Returns

The type mapping to be used.

FindMapping(IProperty) FindMapping(IProperty)

Gets the relational database type for the given property. Returns null if no mapping is found.

public virtual RelationalTypeMapping FindMapping(IProperty property)
Public Overridable Function FindMapping(property As IProperty) As RelationalTypeMapping
Parameters
property
IProperty IProperty

The property to get the mapping for.

Returns

The type mapping to be used.

FindMapping(String) FindMapping(String)

Gets the mapping that represents the given database type. Returns null if no mapping is found.

public virtual RelationalTypeMapping FindMapping(string storeType)
Public Overridable Function FindMapping(storeType As String) As RelationalTypeMapping
Parameters
storeType
System.String System.String

The type to get the mapping for.

Returns

The type mapping to be used.

FindMapping(Type) FindMapping(Type)

Gets the relational database type for a given .NET type. Returns null if no mapping is found.

public virtual RelationalTypeMapping FindMapping(Type clrType)
Public Overridable Function FindMapping(clrType As Type) As RelationalTypeMapping
Parameters
clrType
System.Type System.Type

The type to get the mapping for.

Returns

The type mapping to be used.

GetByteArrayMapping(IProperty) GetByteArrayMapping(IProperty)

Gets the relational database type for the given byte array property.

protected virtual RelationalTypeMapping GetByteArrayMapping(IProperty property)
Protected Overridable Function GetByteArrayMapping(property As IProperty) As RelationalTypeMapping
Parameters
property
IProperty IProperty

The property to get the mapping for.

Returns

The type mapping to be used.

GetClrTypeMappings() GetClrTypeMappings()

Gets the mappings from .NET types to database types.

protected abstract IReadOnlyDictionary<Type, RelationalTypeMapping> GetClrTypeMappings()
Protected MustOverride Function GetClrTypeMappings As IReadOnlyDictionary(Of Type, RelationalTypeMapping)
Returns
System.Collections.Generic.IReadOnlyDictionary<System.Type, RelationalTypeMapping> System.Collections.Generic.IReadOnlyDictionary(Of System.Type, RelationalTypeMapping)

The type mappings.

GetColumnType(IProperty) GetColumnType(IProperty)

Gets column type for the given property.

protected abstract string GetColumnType(IProperty property)
Protected MustOverride Function GetColumnType(property As IProperty) As String
Parameters
property
IProperty IProperty

The property.

Returns
System.String System.String

The name of the database type.

GetHashCode() GetHashCode()

Inherited from System.Object

GetStoreTypeMappings() GetStoreTypeMappings()

Gets the mappings from database types to .NET types.

protected abstract IReadOnlyDictionary<string, RelationalTypeMapping> GetStoreTypeMappings()
Protected MustOverride Function GetStoreTypeMappings As IReadOnlyDictionary(Of String, RelationalTypeMapping)
Returns
System.Collections.Generic.IReadOnlyDictionary<System.String, RelationalTypeMapping> System.Collections.Generic.IReadOnlyDictionary(Of System.String, RelationalTypeMapping)

The type mappings.

GetStringMapping(IProperty) GetStringMapping(IProperty)

Gets the relational database type for the given string property.

protected virtual RelationalTypeMapping GetStringMapping(IProperty property)
Protected Overridable Function GetStringMapping(property As IProperty) As RelationalTypeMapping
Parameters
property
IProperty IProperty

The property to get the mapping for.

Returns

The type mapping to be used.

GetType() GetType()

Inherited from System.Object

MemberwiseClone() MemberwiseClone()

Inherited from System.Object

ReferenceEquals(Object, Object) ReferenceEquals(Object, Object)

Inherited from System.Object

RequiresKeyMapping(IProperty) RequiresKeyMapping(IProperty)

Gets a value indicating whether the given property should use a database type that is suitable for key properties.

protected virtual bool RequiresKeyMapping(IProperty property)
Protected Overridable Function RequiresKeyMapping(property As IProperty) As Boolean
Parameters
property
IProperty IProperty

The property to get the mapping for.

Returns
System.Boolean System.Boolean

True if the property is a key, otherwise false.

ToString() ToString()

Inherited from System.Object

ValidateTypeName(String) ValidateTypeName(String)

Ensures that the given type name is a valid type for the relational database. An exception is thrown if it is not a valid type.

public virtual void ValidateTypeName(string storeType)
Public Overridable Sub ValidateTypeName(storeType As String)
Parameters
storeType
System.String System.String

The type to be validated.