Relational​Type​Mapping Relational​Type​Mapping Class

Definition

Represents the mapping between a .NET type and a database type.

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

public class RelationalTypeMappingPublic Class RelationalTypeMapping
Inheritance
System.ObjectSystem.Object
RelationalTypeMappingRelationalTypeMapping

Inherited Members

System.Object

System.Object.ToString()System.Object.ToString()
System.Object.Equals(System.Object)System.Object.Equals(System.Object)
System.Object.Equals(System.Object, System.Object)System.Object.Equals(System.Object, System.Object)
System.Object.ReferenceEquals(System.Object, System.Object)System.Object.ReferenceEquals(System.Object, System.Object)
System.Object.GetHashCode()System.Object.GetHashCode()
System.Object.GetType()System.Object.GetType()
System.Object.MemberwiseClone()System.Object.MemberwiseClone()

Constructors

RelationalTypeMapping(String, Type) RelationalTypeMapping(String, Type)

Initializes a new instance of the RelationalTypeMapping class.

public RelationalTypeMapping(string storeType, Type clrType)Public Sub New(storeType As String, clrType As Type)
Parameters
storeType
System.String System.String

The name of the database type.

clrType
System.Type System.Type

The .NET type.

RelationalTypeMapping(String, Type, Nullable<DbType>) RelationalTypeMapping(String, Type, Nullable(Of DbType))

Initializes a new instance of the RelationalTypeMapping class.

public RelationalTypeMapping(string storeType, Type clrType, DbType? dbType)Public Sub New(storeType As String, clrType As Type, dbType As DbType?)
Parameters
storeType
System.String System.String

The name of the database type.

clrType
System.Type System.Type

The .NET type.

dbType
System.Nullable<System.Data.DbType> System.Nullable(Of System.Data.DbType)

The System.Data.DbType to be used.

RelationalTypeMapping(String, Type, Nullable<DbType>, Boolean, Nullable<Int32>, Boolean, Boolean) RelationalTypeMapping(String, Type, Nullable(Of DbType), Boolean, Nullable(Of Int32), Boolean, Boolean)

Initializes a new instance of the RelationalTypeMapping class.

public RelationalTypeMapping(string storeType, Type clrType, DbType? dbType, bool unicode, int ? size, bool hasNonDefaultUnicode = false, bool hasNonDefaultSize = false)Public Sub New(storeType As String, clrType As Type, dbType As DbType?, unicode As Boolean, size As Integer?, hasNonDefaultUnicode As Boolean = False, hasNonDefaultSize As Boolean = False)
Parameters
storeType
System.String System.String

The name of the database type.

clrType
System.Type System.Type

The .NET type.

dbType
System.Nullable<System.Data.DbType> System.Nullable(Of System.Data.DbType)

The System.Data.DbType to be used.

unicode
System.Boolean System.Boolean

A value indicating whether the type should handle Unicode data or not.

size
System.Nullable<System.Int32> System.Nullable(Of System.Int32)

The size of data the property is configured to store, or null if no size is configured.

hasNonDefaultUnicode
System.Boolean System.Boolean

A value indicating whether the Unicode setting has been manually configured to a non-default value.

hasNonDefaultSize
System.Boolean System.Boolean

A value indicating whether the size setting has been manually configured to a non-default value.

Fields

NullMapping NullMapping

Gets the mapping to be used when the only piece of information is that there is a null value.

public static readonly RelationalTypeMapping NullMappingPublic Shared ReadOnly NullMapping As RelationalTypeMapping

Properties

ClrType ClrType

Gets the .NET type.

public virtual Type ClrType { get; }Public Overridable ReadOnly Property ClrType As Type
Value
System.Type System.Type

DbType DbType

Gets the System.Data.DbType to be used.

public virtual DbType? DbType { get; }Public Overridable ReadOnly Property DbType As DbType?
Value
System.Nullable<System.Data.DbType> System.Nullable(Of System.Data.DbType)

HasNonDefaultSize HasNonDefaultSize

Gets a value indicating whether the size setting has been manually configured to a non-default value.

public virtual bool HasNonDefaultSize { get; }Public Overridable ReadOnly Property HasNonDefaultSize As Boolean
Value
System.Boolean System.Boolean

HasNonDefaultUnicode HasNonDefaultUnicode

Gets a value indicating whether the Unicode setting has been manually configured to a non-default value.

public virtual bool HasNonDefaultUnicode { get; }Public Overridable ReadOnly Property HasNonDefaultUnicode As Boolean
Value
System.Boolean System.Boolean

IsUnicode IsUnicode

Gets a value indicating whether the type should handle Unicode data or not.

public virtual bool IsUnicode { get; }Public Overridable ReadOnly Property IsUnicode As Boolean
Value
System.Boolean System.Boolean

Size Size

Gets the size of data the property is configured to store, or null if no size is configured.

public virtual int ? Size { get; }Public Overridable ReadOnly Property Size As Integer?
Value
System.Nullable<System.Int32> System.Nullable(Of System.Int32)

StoreType StoreType

Gets the name of the database type.

public virtual string StoreType { get; }Public Overridable ReadOnly Property StoreType As String
Value
System.String System.String

Methods

ConfigureParameter(DbParameter) ConfigureParameter(DbParameter)

Configures type information of a System.Data.Common.DbParameter.

protected virtual void ConfigureParameter(DbParameter parameter)Protected Overridable Sub ConfigureParameter(parameter As DbParameter)
Parameters
parameter
System.Data.Common.DbParameter System.Data.Common.DbParameter

The parameter to be configured.

CreateCopy(String, Nullable<Int32>) CreateCopy(String, Nullable(Of Int32))

Creates a copy of this mapping.

public virtual RelationalTypeMapping CreateCopy(string storeType, int ? size)Public Overridable Function CreateCopy(storeType As String, size As Integer?) As RelationalTypeMapping
Parameters
storeType
System.String System.String

The name of the database type.

size
System.Nullable<System.Int32> System.Nullable(Of System.Int32)

The size of data the property is configured to store, or null if no size is configured.

Returns

The newly created mapping.

CreateParameter(DbCommand, String, Object, Nullable<Boolean>) CreateParameter(DbCommand, String, Object, Nullable(Of Boolean))

Creates a System.Data.Common.DbParameter with the appropriate type information configured.

public virtual DbParameter CreateParameter(DbCommand command, string name, object value, bool ? nullable = null)Public Overridable Function CreateParameter(command As DbCommand, name As String, value As Object, nullable As Boolean? = Nothing) As DbParameter
Parameters
command
System.Data.Common.DbCommand System.Data.Common.DbCommand

The command the parameter should be created on.

name
System.String System.String

The name of the parameter.

value
System.Object System.Object

The value to be assigned to the parameter.

nullable
System.Nullable<System.Boolean> System.Nullable(Of System.Boolean)

A value indicating whether the parameter should be a nullable type.

Returns
System.Data.Common.DbParameter System.Data.Common.DbParameter