Search Results for

    Show / Hide Table of Contents

    Class MappingSchema

    Mapping schema.

    Inheritance
    System.Object
    MappingSchema
    LockedMappingSchema
    Implements
    IConfigurationID
    Namespace: LinqToDB.Mapping
    Assembly: linq2db.dll
    Syntax
    public class MappingSchema : object, IConfigurationID

    Constructors

    | Improve this Doc View Source

    MappingSchema()

    Creates mapping schema instance.

    Declaration
    public MappingSchema()
    | Improve this Doc View Source

    MappingSchema(MappingSchema[])

    Creates mapping schema, derived from other mapping schemata.

    Declaration
    public MappingSchema(params MappingSchema[] schemas)
    Parameters
    Type Name Description
    MappingSchema[] schemas

    Base mapping schemata.

    | Improve this Doc View Source

    MappingSchema(Nullable<String>)

    Creates mapping schema for specified configuration name.

    Declaration
    public MappingSchema(string? configuration)
    Parameters
    Type Name Description
    System.Nullable<System.String> configuration

    Mapping schema configuration name. ProviderName for standard names.

    Remarks

    Schema name should be unique for mapping schemas with different mappings. Using same name could lead to incorrect mapping used when mapping schemas with same name define different mappings for same type.

    | Improve this Doc View Source

    MappingSchema(Nullable<String>, MappingSchema[])

    Creates mapping schema with specified configuration name and base mapping schemas.

    Declaration
    public MappingSchema(string? configuration, params MappingSchema[] schemas)
    Parameters
    Type Name Description
    System.Nullable<System.String> configuration

    Mapping schema configuration name. ProviderName for standard names.

    MappingSchema[] schemas

    Base mapping schemas.

    Remarks

    Schema name should be unique for mapping schemas with different mappings. Using same name could lead to incorrect mapping used when mapping schemas with same name define different mappings for same type.

    Fields

    | Improve this Doc View Source

    Default

    Default mapping schema, used by LINQ to DB, when more specific mapping schema not provided.

    Declaration
    public static MappingSchema Default
    Field Value
    Type Description
    MappingSchema

    Properties

    | Improve this Doc View Source

    ColumnNameComparer

    Gets or sets column name comparison rules for comparison of column names in mapping with column name, returned by provider's data reader.

    Declaration
    public StringComparer ColumnNameComparer { get; set; }
    Property Value
    Type Description
    StringComparer
    | Improve this Doc View Source

    ConfigurationList

    Gets configurations, associated with current mapping schema.

    Declaration
    public string[] ConfigurationList { get; }
    Property Value
    Type Description
    System.String[]
    | Improve this Doc View Source

    DisplayID

    Declaration
    public string DisplayID { get; }
    Property Value
    Type Description
    System.String
    | Improve this Doc View Source

    EntityDescriptorCreatedCallback

    Gets or sets action, called when the EntityDescriptor is created. Could be used to adjust created descriptor before use.

    Declaration
    public Action<MappingSchema, IEntityChangeDescriptor>? EntityDescriptorCreatedCallback { get; set; }
    Property Value
    Type Description
    System.Nullable<Action<MappingSchema, IEntityChangeDescriptor>>
    | Improve this Doc View Source

    IsLockable

    Declaration
    public virtual bool IsLockable { get; }
    Property Value
    Type Description
    System.Boolean
    | Improve this Doc View Source

    IsLocked

    Declaration
    public virtual bool IsLocked { get; }
    Property Value
    Type Description
    System.Boolean
    | Improve this Doc View Source

    MetadataReader

    Gets or sets metadata attributes provider for current schema. Metadata providers, shipped with LINQ to DB:

    • MetadataReader - aggregation metadata provider over collection of other providers;
    • AttributeReader - .NET attributes provider;
    • FluentMetadataReader - fluent mappings metadata provider;
    • SystemDataLinqAttributeReader - metadata provider that converts attributes to LINQ to DB mapping attributes;
    • SystemDataSqlServerAttributeReader - metadata provider that converts attributes to LINQ to DB mapping attributes;
    • XmlAttributeReader - XML-based mappings metadata provider.
    Declaration
    public IMetadataReader MetadataReader { get; set; }
    Property Value
    Type Description
    IMetadataReader
    | Improve this Doc View Source

    ValueToSqlConverter

    Gets value to SQL (usually literal) converter.

    Declaration
    public ValueToSqlConverter ValueToSqlConverter { get; }
    Property Value
    Type Description
    ValueToSqlConverter

    Methods

    | Improve this Doc View Source

    AddMetadataReader(IMetadataReader)

    Adds additional metadata attributes provider to current schema.

    Declaration
    public void AddMetadataReader(IMetadataReader reader)
    Parameters
    Type Name Description
    IMetadataReader reader

    Metadata attributes provider.

    | Improve this Doc View Source

    AddScalarType(Type, DataType, Boolean)

    Configure provided type mapping to scalar database type.

    Declaration
    public void AddScalarType(Type type, DataType dataType = default(DataType), bool withNullable = true)
    Parameters
    Type Name Description
    Type type

    Type to configure.

    DataType dataType

    Optional scalar data type.

    System.Boolean withNullable

    Also register type.

    | Improve this Doc View Source

    AddScalarType(Type, SqlDataType, Boolean)

    Configure provided type mapping to scalar database type.

    Declaration
    public void AddScalarType(Type type, SqlDataType dataType, bool withNullable = true)
    Parameters
    Type Name Description
    Type type

    Type to configure.

    SqlDataType dataType

    Database data type.

    System.Boolean withNullable

    Also register type.

    | Improve this Doc View Source

    AddScalarType(Type, Nullable<Object>, DataType)

    Configure provided type mapping to scalar database type.

    Declaration
    public void AddScalarType(Type type, object? defaultValue, DataType dataType = default(DataType))
    Parameters
    Type Name Description
    Type type

    Type to configure.

    System.Nullable<System.Object> defaultValue

    Default value. See for more details.

    DataType dataType

    Optional scalar data type.

    | Improve this Doc View Source

    AddScalarType(Type, Nullable<Object>, Boolean, DataType)

    Configure provided type mapping to scalar database type.

    Declaration
    public void AddScalarType(Type type, object? defaultValue, bool canBeNull, DataType dataType = default(DataType))
    Parameters
    Type Name Description
    Type type

    Type to configure.

    System.Nullable<System.Object> defaultValue

    Default value. See for more details.

    System.Boolean canBeNull

    Set null value support flag. See SetCanBeNull(Type, Boolean) for more details.

    DataType dataType

    Optional scalar data type.

    | Improve this Doc View Source

    ChangeType(Nullable<Object>, Type)

    Converts value to specified type.

    Declaration
    public object? ChangeType(object? value, Type conversionType)
    Parameters
    Type Name Description
    System.Nullable<System.Object> value

    Value to convert.

    Type conversionType

    Target type.

    Returns
    Type Description
    System.Nullable<System.Object>

    Converted value.

    | Improve this Doc View Source

    ChangeTypeTo<T>(Nullable<Object>)

    Converts value to specified type.

    Declaration
    public T ChangeTypeTo<T>(object? value)
    Parameters
    Type Name Description
    System.Nullable<System.Object> value

    Value to convert.

    Returns
    Type Description
    T

    Converted value.

    Type Parameters
    Name Description
    T

    Target type.

    | Improve this Doc View Source

    ClearCache()

    Clears EntityDescriptor cache.

    Declaration
    public static void ClearCache()
    | Improve this Doc View Source

    EnumToValue(Enum)

    Converts enum value to database value.

    Declaration
    public object? EnumToValue(Enum value)
    Parameters
    Type Name Description
    Enum value

    Enum value.

    Returns
    Type Description
    System.Nullable<System.Object>

    Database value.

    | Improve this Doc View Source

    GenerateConvertedValueExpression(Nullable<Object>, Type)

    Declaration
    public Expression GenerateConvertedValueExpression(object? value, Type type)
    Parameters
    Type Name Description
    System.Nullable<System.Object> value
    Type type
    Returns
    Type Description
    Expression
    | Improve this Doc View Source

    GenerateID()

    Declaration
    protected virtual int GenerateID()
    Returns
    Type Description
    System.Int32
    | Improve this Doc View Source

    GenerateSafeConvert(Type, Type)

    Declaration
    public LambdaExpression GenerateSafeConvert(Type fromType, Type type)
    Parameters
    Type Name Description
    Type fromType
    Type type
    Returns
    Type Description
    LambdaExpression
    | Improve this Doc View Source

    GetAttribute<T>(Type, Func<T, Nullable<String>>, Boolean)

    Gets attribute of specified type, associated with specified type. Attributes filtered by schema's configuration names (see ConfigurationList).

    Declaration
    public T GetAttribute<T>(Type type, Func<T, string?> configGetter, bool inherit = true)
        where T : Attribute
    Parameters
    Type Name Description
    Type type

    Attribute owner type.

    Func<T, System.Nullable<System.String>> configGetter

    Attribute configuration name provider.

    System.Boolean inherit

    If true - include inherited attribute.

    Returns
    Type Description
    T

    First found attribute of specified type or null, if no attributes found.

    Type Parameters
    Name Description
    T

    Attribute type.

    | Improve this Doc View Source

    GetAttribute<T>(Type, MemberInfo, Func<T, Nullable<String>>, Boolean)

    Gets attribute of specified type, associated with specified type member. Attributes filtered by schema's configuration names (see ConfigurationList).

    Declaration
    public T GetAttribute<T>(Type type, MemberInfo memberInfo, Func<T, string?> configGetter, bool inherit = true)
        where T : Attribute
    Parameters
    Type Name Description
    Type type

    Member's owner type.

    MemberInfo memberInfo

    Attribute owner member.

    Func<T, System.Nullable<System.String>> configGetter

    Attribute configuration name provider.

    System.Boolean inherit

    If true - include inherited attribute.

    Returns
    Type Description
    T

    First found attribute of specified type or null, if no attributes found.

    Type Parameters
    Name Description
    T

    Attribute type.

    | Improve this Doc View Source

    GetAttribute<T>(Type, MemberInfo, Boolean)

    Gets attribute of specified type, associated with specified type member.

    Declaration
    public T GetAttribute<T>(Type type, MemberInfo memberInfo, bool inherit = true)
        where T : Attribute
    Parameters
    Type Name Description
    Type type

    Member's owner type.

    MemberInfo memberInfo

    Attribute owner member.

    System.Boolean inherit

    If true - include inherited attribute.

    Returns
    Type Description
    T

    First found attribute of specified type or null, if no attributes found.

    Type Parameters
    Name Description
    T

    Attribute type.

    | Improve this Doc View Source

    GetAttribute<T>(Type, Boolean)

    Gets attribute of specified type, associated with specified type.

    Declaration
    public T GetAttribute<T>(Type type, bool inherit = true)
        where T : Attribute
    Parameters
    Type Name Description
    Type type

    Attribute owner type.

    System.Boolean inherit

    If true - include inherited attribute.

    Returns
    Type Description
    T

    First found attribute of specified type or null, if no attributes found.

    Type Parameters
    Name Description
    T

    Attribute type.

    | Improve this Doc View Source

    GetAttributes<T>(Type, Func<T, Nullable<String>>, Boolean, Boolean)

    Gets attributes of specified type, associated with specified type. Attributes filtered by schema's configuration names (see ConfigurationList).

    Declaration
    public T[] GetAttributes<T>(Type type, Func<T, string?> configGetter, bool inherit = true, bool exactForConfiguration = false)
        where T : Attribute
    Parameters
    Type Name Description
    Type type

    Attributes owner type.

    Func<T, System.Nullable<System.String>> configGetter

    Attribute configuration name provider.

    System.Boolean inherit

    If true - include inherited attributes.

    System.Boolean exactForConfiguration

    If true - only associated to configuration attributes will be returned.

    Returns
    Type Description
    T[]

    Attributes of specified type.

    Type Parameters
    Name Description
    T

    Attribute type.

    | Improve this Doc View Source

    GetAttributes<T>(Type, MemberInfo, Func<T, Nullable<String>>, Boolean, Boolean)

    Gets attributes of specified type, associated with specified type member. Attributes filtered by schema's configuration names (see ConfigurationList).

    Declaration
    public T[] GetAttributes<T>(Type type, MemberInfo memberInfo, Func<T, string?> configGetter, bool inherit = true, bool exactForConfiguration = false)
        where T : Attribute
    Parameters
    Type Name Description
    Type type

    Member's owner type.

    MemberInfo memberInfo

    Attributes owner member.

    Func<T, System.Nullable<System.String>> configGetter

    Attribute configuration name provider.

    System.Boolean inherit

    If true - include inherited attributes.

    System.Boolean exactForConfiguration

    If true - only associated to configuration attributes will be returned.

    Returns
    Type Description
    T[]

    Attributes of specified type.

    Type Parameters
    Name Description
    T

    Attribute type.

    | Improve this Doc View Source

    GetAttributes<T>(Type, MemberInfo, Boolean)

    Gets attributes of specified type, associated with specified type member.

    Declaration
    public T[] GetAttributes<T>(Type type, MemberInfo memberInfo, bool inherit = true)
        where T : Attribute
    Parameters
    Type Name Description
    Type type

    Member's owner type.

    MemberInfo memberInfo

    Attributes owner member.

    System.Boolean inherit

    If true - include inherited attributes.

    Returns
    Type Description
    T[]

    Attributes of specified type.

    Type Parameters
    Name Description
    T

    Attribute type.

    | Improve this Doc View Source

    GetAttributes<T>(Type, Boolean)

    Gets attributes of specified type, associated with specified type.

    Declaration
    public T[] GetAttributes<T>(Type type, bool inherit = true)
        where T : Attribute
    Parameters
    Type Name Description
    Type type

    Attributes owner type.

    System.Boolean inherit

    If true - include inherited attributes.

    Returns
    Type Description
    T[]

    Attributes of specified type.

    Type Parameters
    Name Description
    T

    Attribute type.

    | Improve this Doc View Source

    GetCanBeNull(Type)

    Returns true, if value of specified type could contain null.

    Declaration
    public bool GetCanBeNull(Type type)
    Parameters
    Type Name Description
    Type type

    Value type.

    Returns
    Type Description
    System.Boolean

    Returns true if specified type supports null values.

    | Improve this Doc View Source

    GetConverter<TFrom, TTo>()

    Returns conversion delegate for conversion from TFrom type to TTo type.

    Declaration
    public Func<TFrom, TTo>? GetConverter<TFrom, TTo>()
    Returns
    Type Description
    System.Nullable<Func<TFrom, TTo>>

    Conversion delegate or null if conversion is not defined.

    Type Parameters
    Name Description
    TFrom

    Source type.

    TTo

    Target type.

    | Improve this Doc View Source

    GetConvertExpression(DbDataType, DbDataType, Boolean, Boolean)

    Returns conversion expression from from type to to type.

    Declaration
    public LambdaExpression? GetConvertExpression(DbDataType from, DbDataType to, bool checkNull = true, bool createDefault = true)
    Parameters
    Type Name Description
    DbDataType from

    Source type.

    DbDataType to

    Target type.

    System.Boolean checkNull

    If true, and source type could contain null, conversion expression will check converted value for null and replace it with default value. for more details.

    System.Boolean createDefault

    Create new conversion expression, if conversion is not defined.

    Returns
    Type Description
    System.Nullable<LambdaExpression>

    Conversion expression or null, if there is no such conversion and createDefault is false.

    | Improve this Doc View Source

    GetConvertExpression(Type, Type, Boolean, Boolean)

    Returns conversion expression from from type to to type.

    Declaration
    public LambdaExpression? GetConvertExpression(Type from, Type to, bool checkNull = true, bool createDefault = true)
    Parameters
    Type Name Description
    Type from

    Source type.

    Type to

    Target type.

    System.Boolean checkNull

    If true, and source type could contain null, conversion expression will check converted value for null and replace it with default value. for more details.

    System.Boolean createDefault

    Create new conversion expression, if conversion is not defined.

    Returns
    Type Description
    System.Nullable<LambdaExpression>

    Conversion expression or null, if there is no such conversion and createDefault is false.

    | Improve this Doc View Source

    GetConvertExpression<TFrom, TTo>(Boolean, Boolean)

    Returns conversion expression from TFrom type to TTo type.

    Declaration
    public Expression<Func<TFrom, TTo>>? GetConvertExpression<TFrom, TTo>(bool checkNull = true, bool createDefault = true)
    Parameters
    Type Name Description
    System.Boolean checkNull

    If true, and source type could contain null, conversion expression will check converted value for null and replace it with default value. for more details.

    System.Boolean createDefault

    Create new conversion expression, if conversion is not defined.

    Returns
    Type Description
    System.Nullable<Expression<Func<TFrom, TTo>>>

    Conversion expression or null, if there is no such conversion and createDefault is false.

    Type Parameters
    Name Description
    TFrom

    Source type.

    TTo

    Target type.

    | Improve this Doc View Source

    GetDataType(Type)

    Returns database type mapping information for specified type.

    Declaration
    public SqlDataType GetDataType(Type type)
    Parameters
    Type Name Description
    Type type

    Mapped type.

    Returns
    Type Description
    SqlDataType

    Database type information.

    | Improve this Doc View Source

    GetDefaultFromEnumType(Type)

    Returns type, to which provided enumeration type is mapped or null, if type is not configured. See SetDefaultFromEnumType(Type, Type).

    Declaration
    public Type? GetDefaultFromEnumType(Type enumType)
    Parameters
    Type Name Description
    Type enumType

    Enumeration type.

    Returns
    Type Description
    System.Nullable<Type>

    Mapped type or null.

    | Improve this Doc View Source

    GetDefaultValue(Type)

    Returns default value for specified type. Default value is a value, used instead of NULL value, read from database.

    Declaration
    public object? GetDefaultValue(Type type)
    Parameters
    Type Name Description
    Type type

    Value type.

    Returns
    Type Description
    System.Nullable<System.Object>

    Returns default value for type.

    | Improve this Doc View Source

    GetDefinedTypes()

    Enumerates types registered by FluentMetadataBuilder.

    Declaration
    public Type[] GetDefinedTypes()
    Returns
    Type Description
    Type[]

    Returns array with all types, mapped by fluent mappings.

    | Improve this Doc View Source

    GetDynamicColumns(Type)

    Gets the dynamic columns defined on given type.

    Declaration
    public MemberInfo[] GetDynamicColumns(Type type)
    Parameters
    Type Name Description
    Type type

    The type.

    Returns
    Type Description
    MemberInfo[]

    All dynamic columns defined on given type.

    | Improve this Doc View Source

    GetEntityDescriptor(Type)

    Returns mapped entity descriptor.

    Declaration
    public EntityDescriptor GetEntityDescriptor(Type type)
    Parameters
    Type Name Description
    Type type

    Mapped type.

    Returns
    Type Description
    EntityDescriptor

    Mapping descriptor.

    | Improve this Doc View Source

    GetFluentMappingBuilder()

    Gets fluent mapping builder for current schema.

    Declaration
    public FluentMappingBuilder GetFluentMappingBuilder()
    Returns
    Type Description
    FluentMappingBuilder

    Fluent mapping builder.

    | Improve this Doc View Source

    GetMapValues(Type)

    Returns enum type mapping information or null for non-enum types.

    Declaration
    public virtual MapValue[] GetMapValues(Type type)
    Parameters
    Type Name Description
    Type type

    Mapped type.

    Returns
    Type Description
    MapValue[]

    Mapping values for enum type and null for non-enum types.

    | Improve this Doc View Source

    GetUnderlyingDataType(Type, out Boolean)

    Returns scalar database type mapping information for provided type.

    Declaration
    public SqlDataType GetUnderlyingDataType(Type type, out bool canBeNull)
    Parameters
    Type Name Description
    Type type

    Mapped type.

    System.Boolean canBeNull

    Returns true, if type type is enum with mapping to null value. Initial parameter value, passed to this method is not used.

    Returns
    Type Description
    SqlDataType

    Scalar database type information.

    | Improve this Doc View Source

    InitGenericConvertProvider(Type[])

    Initialize generic conversions for specific type parameters.

    Declaration
    public bool InitGenericConvertProvider(params Type[] types)
    Parameters
    Type Name Description
    Type[] types

    Generic type parameters.

    Returns
    Type Description
    System.Boolean

    Returns true if new generic type conversions could have added to mapping schema.

    | Improve this Doc View Source

    InitGenericConvertProvider<T>()

    Initialize generic conversions for specific type parameter.

    Declaration
    public void InitGenericConvertProvider<T>()
    Type Parameters
    Name Description
    T

    Generic type parameter, for which converters should be initialized.

    | Improve this Doc View Source

    IsScalarType(Type)

    Returns true, if provided type mapped to scalar database type in current schema.

    Declaration
    public bool IsScalarType(Type type)
    Parameters
    Type Name Description
    Type type

    Type to check.

    Returns
    Type Description
    System.Boolean

    true, if type mapped to scalar database type.

    | Improve this Doc View Source

    SetCanBeNull(Type, Boolean)

    Sets null value support flag for specified type.

    Declaration
    public void SetCanBeNull(Type type, bool value)
    Parameters
    Type Name Description
    Type type

    Value type.

    System.Boolean value

    If true, specified type value could contain null.

    | Improve this Doc View Source

    SetConverter<TFrom, TTo>(Func<TFrom, TTo>)

    Specify conversion delegate for conversion from TFrom type to TTo type.

    Declaration
    public void SetConverter<TFrom, TTo>(Func<TFrom, TTo> func)
    Parameters
    Type Name Description
    Func<TFrom, TTo> func

    Conversion delegate.

    Type Parameters
    Name Description
    TFrom

    Source type.

    TTo

    Target type.

    | Improve this Doc View Source

    SetConverter<TFrom, TTo>(Func<TFrom, TTo>, DbDataType, DbDataType)

    Specify conversion delegate for conversion from TFrom type to TTo type.

    Declaration
    public void SetConverter<TFrom, TTo>(Func<TFrom, TTo> func, DbDataType from, DbDataType to)
    Parameters
    Type Name Description
    Func<TFrom, TTo> func

    Conversion delegate.

    DbDataType from

    Source type detalization

    DbDataType to

    Target type detalization

    Type Parameters
    Name Description
    TFrom

    Source type.

    TTo

    Target type.

    | Improve this Doc View Source

    SetConvertExpression(DbDataType, DbDataType, LambdaExpression, Boolean)

    Specify conversion expression for conversion from fromType type to toType type.

    Declaration
    public void SetConvertExpression(DbDataType fromType, DbDataType toType, LambdaExpression expr, bool addNullCheck = true)
    Parameters
    Type Name Description
    DbDataType fromType

    Source type.

    DbDataType toType

    Target type.

    LambdaExpression expr

    Conversion expression.

    System.Boolean addNullCheck

    If true, conversion expression will be wrapped with default value substitution logic for null values. Wrapper will be added only if source type can have null values and conversion expression doesn't use default value provider. See DefaultValue<T> and DefaultValue types for more details.

    | Improve this Doc View Source

    SetConvertExpression(Type, Type, LambdaExpression, Boolean)

    Specify conversion expression for conversion from fromType type to toType type.

    Declaration
    public void SetConvertExpression(Type fromType, Type toType, LambdaExpression expr, bool addNullCheck = true)
    Parameters
    Type Name Description
    Type fromType

    Source type.

    Type toType

    Target type.

    LambdaExpression expr

    Conversion expression.

    System.Boolean addNullCheck

    If true, conversion expression will be wrapped with default value substitution logic for null values. Wrapper will be added only if source type can have null values and conversion expression doesn't use default value provider. See DefaultValue<T> and DefaultValue types for more details.

    | Improve this Doc View Source

    SetConvertExpression<TFrom, TTo>(Expression<Func<TFrom, TTo>>, Expression<Func<TFrom, TTo>>)

    Specify conversion expression for conversion from TFrom type to TTo type.

    Declaration
    public void SetConvertExpression<TFrom, TTo>(Expression<Func<TFrom, TTo>> checkNullExpr, Expression<Func<TFrom, TTo>> expr)
    Parameters
    Type Name Description
    Expression<Func<TFrom, TTo>> checkNullExpr

    null values conversion expression.

    Expression<Func<TFrom, TTo>> expr

    Conversion expression.

    Type Parameters
    Name Description
    TFrom

    Source type.

    TTo

    Target type.

    | Improve this Doc View Source

    SetConvertExpression<TFrom, TTo>(Expression<Func<TFrom, TTo>>, Boolean)

    Specify conversion expression for conversion from TFrom type to TTo type.

    Declaration
    public void SetConvertExpression<TFrom, TTo>(Expression<Func<TFrom, TTo>> expr, bool addNullCheck = true)
    Parameters
    Type Name Description
    Expression<Func<TFrom, TTo>> expr

    Conversion expression.

    System.Boolean addNullCheck

    If true, conversion expression will be wrapped with default value substitution logic for null values. Wrapper will be added only if source type can have null values and conversion expression doesn't use default value provider. See DefaultValue<T> and DefaultValue types for more details.

    Type Parameters
    Name Description
    TFrom

    Source type.

    TTo

    Target type.

    | Improve this Doc View Source

    SetCultureInfo(CultureInfo)

    Set conversion expressions for conversion from and to string for basic types (byte, sbyte, short, ushort, int, uint, long, ulong , float, double, decimal, DateTime, DateTimeOffset) using provided culture format providers.

    Declaration
    public void SetCultureInfo(CultureInfo info)
    Parameters
    Type Name Description
    CultureInfo info

    Culture with format providers for conversions.

    | Improve this Doc View Source

    SetDataType(Type, DataType)

    Associate specified type with LINQ to DB data type.

    Declaration
    public void SetDataType(Type type, DataType dataType)
    Parameters
    Type Name Description
    Type type

    Mapped type.

    DataType dataType

    LINQ to DB data type.

    | Improve this Doc View Source

    SetDataType(Type, SqlDataType)

    Associate specified type with database data type.

    Declaration
    public void SetDataType(Type type, SqlDataType dataType)
    Parameters
    Type Name Description
    Type type

    Mapped type.

    SqlDataType dataType

    Database data type.

    | Improve this Doc View Source

    SetDefaultFromEnumType(Type, Type)

    Sets type, to which provided enumeration type should be mapped.

    Declaration
    public void SetDefaultFromEnumType(Type enumType, Type defaultFromType)
    Parameters
    Type Name Description
    Type enumType

    Enumeration type.

    Type defaultFromType

    Mapped type.

    | Improve this Doc View Source

    SetDefaultValue(Type, Nullable<Object>)

    Sets default value for specific type. Default value is a value, used instead of NULL value, read from database.

    Declaration
    public void SetDefaultValue(Type type, object? value)
    Parameters
    Type Name Description
    Type type

    Value type.

    System.Nullable<System.Object> value

    Default value.

    | Improve this Doc View Source

    SetGenericConvertProvider(Type)

    Adds generic type conversions provider. Type converter must implement IGenericInfoProvider interface. IGenericInfoProvider for more details and examples.

    Declaration
    public void SetGenericConvertProvider(Type type)
    Parameters
    Type Name Description
    Type type

    Generic type conversions provider.

    | Improve this Doc View Source

    SetScalarType(Type, Boolean)

    Configure how provided type should be handled during mapping to database - as scalar value or composite type.

    Declaration
    public void SetScalarType(Type type, bool isScalarType = true)
    Parameters
    Type Name Description
    Type type

    Type to configure.

    System.Boolean isScalarType

    true, if provided type should be mapped to scalar database value.

    | Improve this Doc View Source

    SetValueToSqlConverter(Type, Action<StringBuilder, SqlDataType, DataOptions, Object>)

    Sets value to SQL converter action for specific value type.

    Declaration
    public void SetValueToSqlConverter(Type type, Action<StringBuilder, SqlDataType, DataOptions, object> converter)
    Parameters
    Type Name Description
    Type type

    Value type.

    Action<StringBuilder, SqlDataType, DataOptions, System.Object> converter

    Converter action. Action accepts three parameters:

    • SQL string builder to write generated value SQL to;
    • value SQL type descriptor;
    • value.
    | Improve this Doc View Source

    SetValueToSqlConverter(Type, Action<StringBuilder, SqlDataType, Object>)

    Sets value to SQL converter action for specific value type.

    Declaration
    public void SetValueToSqlConverter(Type type, Action<StringBuilder, SqlDataType, object> converter)
    Parameters
    Type Name Description
    Type type

    Value type.

    Action<StringBuilder, SqlDataType, System.Object> converter

    Converter action. Action accepts three parameters:

    • SQL string builder to write generated value SQL to;
    • value SQL type descriptor;
    • value.
    | Improve this Doc View Source

    TryGetConvertExpression(Type, Type)

    Returns custom value conversion expression from from type to to type if it is defined in mapping schema, or null otherwise.

    Declaration
    public virtual LambdaExpression? TryGetConvertExpression(Type from, Type to)
    Parameters
    Type Name Description
    Type from

    Source type.

    Type to

    Target type.

    Returns
    Type Description
    System.Nullable<LambdaExpression>

    Conversion expression or null, if conversion is not defined.

    Explicit Interface Implementations

    | Improve this Doc View Source

    IConfigurationID.ConfigurationID

    Unique schema configuration identifier. For internal use only.

    Declaration
    int IConfigurationID.ConfigurationID { get; }
    Returns
    Type Description
    System.Int32

    Implements

    IConfigurationID

    Extension Methods

    MappingSchemaExtensions.GetEqualityComparer<T>(MappingSchema, Func<ColumnDescriptor, Boolean>)
    MappingSchemaExtensions.GetEntityEqualityComparer<T>(MappingSchema)
    MappingSchemaExtensions.GetKeyEqualityComparer<T>(MappingSchema)
    Map.DeepCopy<T>(T)
    Sql.IsDistinctFrom<T>(T, T)
    Sql.IsNotDistinctFrom<T>(T, T)
    SqlExtensions.In<T>(T, IEnumerable<T>)
    SqlExtensions.In<T>(T, IQueryable<T>)
    SqlExtensions.In<T>(T, T[])
    SqlExtensions.In<T>(T, T, T)
    SqlExtensions.In<T>(T, T, T, T)
    SqlExtensions.NotIn<T>(T, IEnumerable<T>)
    SqlExtensions.NotIn<T>(T, IQueryable<T>)
    SqlExtensions.NotIn<T>(T, T[])
    SqlExtensions.NotIn<T>(T, T, T)
    SqlExtensions.NotIn<T>(T, T, T, T)
    • Improve this Doc
    • View Source
    In This Article
    Back to top Copyright © 2011-2022 linq2db.com

    Generated by DocFX