Search Results for

    Show / Hide Table of Contents

    Class ColumnDescriptor

    Stores mapping entity column descriptor.

    Inheritance
    object
    ColumnDescriptor
    Implements
    IColumnChangeDescriptor
    Namespace: LinqToDB.Mapping
    Assembly: linq2db.dll
    Syntax
    public class ColumnDescriptor : IColumnChangeDescriptor

    Constructors

    | Improve this Doc View Source

    ColumnDescriptor(MappingSchema, EntityDescriptor, ColumnAttribute?, MemberAccessor, bool)

    Creates descriptor instance.

    Declaration
    public ColumnDescriptor(MappingSchema mappingSchema, EntityDescriptor entityDescriptor, ColumnAttribute? columnAttribute, MemberAccessor memberAccessor, bool hasInheritanceMapping)
    Parameters
    Type Name Description
    MappingSchema mappingSchema

    Mapping schema, associated with descriptor.

    EntityDescriptor entityDescriptor

    Entity descriptor.

    ColumnAttribute columnAttribute

    Column attribute, from which descriptor data should be extracted.

    MemberAccessor memberAccessor

    Column mapping member accessor.

    bool hasInheritanceMapping

    Owning entity included in inheritance mapping.

    Properties

    | Improve this Doc View Source

    CanBeNull

    Gets whether a column can contain null values.

    Declaration
    public bool CanBeNull { get; }
    Property Value
    Type Description
    bool
    | Improve this Doc View Source

    ColumnName

    Gets the name of a column in database. If not specified, MemberName value will be used.

    Declaration
    public string ColumnName { get; }
    Property Value
    Type Description
    string
    | Improve this Doc View Source

    CreateFormat

    Custom template for column definition in create table SQL expression, generated using CreateTable<T>(IDataContext, string?, string?, string?, string?, string?, DefaultNullable, string?, TableOptions) methods. Template accepts following string parameters:

    • {0} - column name;
    • {1} - column type;
    • {2} - NULL specifier;
    • {3} - identity specification.
    Declaration
    public string? CreateFormat { get; }
    Property Value
    Type Description
    string
    | Improve this Doc View Source

    DataType

    Gets LINQ to DB type for column.

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

    DbType

    Gets the name of the database column type.

    Declaration
    public string? DbType { get; }
    Property Value
    Type Description
    string
    | Improve this Doc View Source

    EntityDescriptor

    Gets Entity descriptor.

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

    HasInheritanceMapping

    Indicates that owning entity included in inheritance mapping.

    Declaration
    public bool HasInheritanceMapping { get; }
    Property Value
    Type Description
    bool
    | Improve this Doc View Source

    HasValuesToSkipOnInsert

    Gets whether the column has specific values that should be skipped on insert.

    Declaration
    public bool HasValuesToSkipOnInsert { get; }
    Property Value
    Type Description
    bool
    | Improve this Doc View Source

    HasValuesToSkipOnUpdate

    Gets whether the column has specific values that should be skipped on update.

    Declaration
    public bool HasValuesToSkipOnUpdate { get; }
    Property Value
    Type Description
    bool
    | Improve this Doc View Source

    IsDiscriminator

    Gets whether a column contains a discriminator value for a LINQ to DB inheritance hierarchy. InheritanceMappingAttribute for more details. Default value: false.

    Declaration
    public bool IsDiscriminator { get; }
    Property Value
    Type Description
    bool
    | Improve this Doc View Source

    IsIdentity

    Gets whether a column contains values that the database auto-generates.

    Declaration
    public bool IsIdentity { get; }
    Property Value
    Type Description
    bool
    | Improve this Doc View Source

    IsPrimaryKey

    Gets whether this member represents a column that is part or all of the primary key of the table. Also see PrimaryKeyAttribute.

    Declaration
    public bool IsPrimaryKey { get; }
    Property Value
    Type Description
    bool
    | Improve this Doc View Source

    Length

    Gets the length of the database column.

    Declaration
    public int? Length { get; }
    Property Value
    Type Description
    int?
    | Improve this Doc View Source

    MappingSchema

    Gets MappingSchema for current ColumnDescriptor.

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

    MemberAccessor

    Gets column mapping member accessor.

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

    MemberInfo

    Gets column mapping member (field or property).

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

    MemberName

    Gets the name of mapped member. When applied to class or interface, should contain name of property of field.

    If column is mapped to a property or field of composite object, MemberName should contain a path to that member using dot as separator.

    public class Address
    {
        public string City     { get; set; }
        public string Street   { get; set; }
        public int    Building { get; set; }
    }
    
    [Column("city", "Residence.Street")]
    [Column("user_name", "Name")]
    public class User
    {
        public string Name;
    
        [Column("street", ".Street")]
        [Column("building_number", MemberName = ".Building")]
        public Address Residence { get; set; }
    }
    Declaration
    public string MemberName { get; }
    Property Value
    Type Description
    string
    | Improve this Doc View Source

    MemberType

    Gets type of column mapping member (field or property).

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

    Order

    Sort order for column list. Positive values first, then unspecified (null), then negative values.

    Declaration
    public int? Order { get; }
    Property Value
    Type Description
    int?
    | Improve this Doc View Source

    Precision

    Gets the precision of the database column.

    Declaration
    public int? Precision { get; }
    Property Value
    Type Description
    int?
    | Improve this Doc View Source

    PrimaryKeyOrder

    Gets order of current column in composite primary key. Order is used for query generation to define in which order primary key columns must be mentioned in query from columns with smallest order value to greatest.

    Declaration
    public int PrimaryKeyOrder { get; }
    Property Value
    Type Description
    int
    | Improve this Doc View Source

    Scale

    Gets the Scale of the database column.

    Declaration
    public int? Scale { get; }
    Property Value
    Type Description
    int?
    | Improve this Doc View Source

    SequenceName

    Gets sequence name for specified column.

    Declaration
    public SequenceNameAttribute? SequenceName { get; }
    Property Value
    Type Description
    SequenceNameAttribute
    | Improve this Doc View Source

    SkipModificationFlags

    Gets flags for which operation values are skipped.

    Declaration
    public SkipModification SkipModificationFlags { get; }
    Property Value
    Type Description
    SkipModification
    | Improve this Doc View Source

    SkipOnEntityFetch

    Gets whether a column must be explicitly defined in a Select statement to be fetched. If true, a "SELECT *"-ish statement won't retrieve this column. Default value: false.

    Declaration
    public bool SkipOnEntityFetch { get; }
    Property Value
    Type Description
    bool
    | Improve this Doc View Source

    SkipOnInsert

    Gets whether a column is insertable. This flag will affect only insert operations with implicit columns specification like Insert<T>(IDataContext, T, string?, string?, string?, string?, TableOptions) method and will be ignored when user explicitly specifies value for this column.

    Declaration
    public bool SkipOnInsert { get; }
    Property Value
    Type Description
    bool
    | Improve this Doc View Source

    SkipOnUpdate

    Gets whether a column is updatable. This flag will affect only update operations with implicit columns specification like Update<T>(IDataContext, T, string?, string?, string?, string?, TableOptions) method and will be ignored when user explicitly specifies value for this column.

    Declaration
    public bool SkipOnUpdate { get; }
    Property Value
    Type Description
    bool
    | Improve this Doc View Source

    Storage

    Gets storage property or field to hold the value from a column. Could be usefull e.g. in combination of private storage field and getter-only mapping property.

    Declaration
    public string? Storage { get; }
    Property Value
    Type Description
    string
    | Improve this Doc View Source

    StorageInfo

    Gets value storage member (field or property).

    Declaration
    public MemberInfo StorageInfo { get; }
    Property Value
    Type Description
    MemberInfo
    | Improve this Doc View Source

    StorageType

    Gets type of column value storage member (field or property).

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

    ValueConverter

    Gets value converter for specific column.

    Declaration
    public IValueConverter? ValueConverter { get; }
    Property Value
    Type Description
    IValueConverter

    Methods

    | Improve this Doc View Source

    ApplyConversions(MappingSchema, Expression, DbDataType, IValueConverter?, bool)

    Helper function for applying all needed conversions for converting value to database type.

    Declaration
    public static Expression ApplyConversions(MappingSchema mappingSchema, Expression getterExpr, DbDataType dbDataType, IValueConverter? valueConverter, bool includingEnum)
    Parameters
    Type Name Description
    MappingSchema mappingSchema

    Mapping schema.

    Expression getterExpr

    Expression which returns value which has to be converted.

    DbDataType dbDataType

    Database type.

    IValueConverter valueConverter

    Optional IValueConverter

    bool includingEnum

    Provides default enum conversion.

    Returns
    Type Description
    Expression

    Expression with applied conversions.

    | Improve this Doc View Source

    ApplyConversions(Expression, DbDataType, bool)

    Helper function for applying all needed conversions for converting value to database type.

    Declaration
    public Expression ApplyConversions(Expression getterExpr, DbDataType dbDataType, bool includingEnum)
    Parameters
    Type Name Description
    Expression getterExpr

    Expression which returns value which has to be converted.

    DbDataType dbDataType

    Database type.

    bool includingEnum

    Provides default enum conversion.

    Returns
    Type Description
    Expression

    Expression with applied conversions.

    | Improve this Doc View Source

    CalculateDbDataType(MappingSchema, Type)

    Declaration
    public static DbDataType CalculateDbDataType(MappingSchema mappingSchema, Type systemType)
    Parameters
    Type Name Description
    MappingSchema mappingSchema
    Type systemType
    Returns
    Type Description
    DbDataType
    | Improve this Doc View Source

    GetConvertedDbDataType()

    Returns DbDataType for current column after conversions.

    Declaration
    public DbDataType GetConvertedDbDataType()
    Returns
    Type Description
    DbDataType
    | Improve this Doc View Source

    GetDbDataType(bool)

    Returns DbDataType for current column.

    Declaration
    public DbDataType GetDbDataType(bool completeDataType)
    Parameters
    Type Name Description
    bool completeDataType
    Returns
    Type Description
    DbDataType
    | Improve this Doc View Source

    GetDbParamLambda()

    Returns Lambda for extracting column value, converted to database type or DataParameter, from entity object.

    Declaration
    public LambdaExpression GetDbParamLambda()
    Returns
    Type Description
    LambdaExpression

    Returns Lambda which extracts member value to database type or DataParameter.

    | Improve this Doc View Source

    GetDbValueLambda()

    Returns Lambda for extracting column value, converted to database type, from entity object.

    Declaration
    public LambdaExpression GetDbValueLambda()
    Returns
    Type Description
    LambdaExpression

    Returns Lambda which extracts member value to database type.

    | Improve this Doc View Source

    GetDefaultDbParamExpression()

    Returns default column value, converted to database type or DataParameter.

    Declaration
    public Expression GetDefaultDbParamExpression()
    Returns
    Type Description
    Expression
    | Improve this Doc View Source

    GetDefaultDbValueExpression()

    Returns Lambda for extracting column value, converted to database type, from entity object.

    Declaration
    public Expression GetDefaultDbValueExpression()
    Returns
    Type Description
    Expression

    Returns Lambda which extracts member value to database type.

    | Improve this Doc View Source

    GetOriginalValueLambda()

    Returns Lambda for extracting original column value from entity object.

    Declaration
    public LambdaExpression GetOriginalValueLambda()
    Returns
    Type Description
    LambdaExpression

    Returns Lambda which extracts member value.

    | Improve this Doc View Source

    GetProviderValue(object)

    Extracts column value, converted to database type, from entity object.

    Declaration
    public virtual object? GetProviderValue(object obj)
    Parameters
    Type Name Description
    object obj

    Entity object to extract column value from.

    Returns
    Type Description
    object

    Returns column value, converted to database type.

    | Improve this Doc View Source

    ShouldSkip(object, EntityDescriptor, SkipModification)

    Checks if the passed object has values that should bes skipped based on the given flags.

    Declaration
    public virtual bool ShouldSkip(object obj, EntityDescriptor descriptor, SkipModification flags)
    Parameters
    Type Name Description
    object obj

    The object containing the values for the operation.

    EntityDescriptor descriptor

    EntityDescriptor of the current instance.

    SkipModification flags

    The flags that specify which operation should be checked.

    Returns
    Type Description
    bool

    true if object contains values that should be skipped.

    Implements

    IColumnChangeDescriptor

    Extension Methods

    Sql.IsDistinctFrom<T>(T, T)
    Sql.IsNotDistinctFrom<T>(T, T)
    Map.DeepCopy<T>(T)
    SqlExtensions.In<T>(T, T, T, T)
    SqlExtensions.In<T>(T, T, T)
    SqlExtensions.In<T>(T, params T[])
    SqlExtensions.In<T>(T, IEnumerable<T>)
    SqlExtensions.In<T>(T, IQueryable<T>)
    SqlExtensions.NotIn<T>(T, T, T, T)
    SqlExtensions.NotIn<T>(T, T, T)
    SqlExtensions.NotIn<T>(T, params T[])
    SqlExtensions.NotIn<T>(T, IEnumerable<T>)
    SqlExtensions.NotIn<T>(T, IQueryable<T>)
    • Improve this Doc
    • View Source
    In This Article
    Back to top Copyright © 2011-2023 linq2db.com

    Generated by DocFX