Table of Contents

Namespace LinqToDB.Mapping

Classes

AssociationAttribute

Defines relation between tables or views. Could be applied to:

  • instance properties and fields;
  • instance and static methods.

For associations, defined using static methods, this mapping side defined by type of first parameter. Also, optionally, you can pass data context object as extra method parameter.

Based on association type - to one or to multiple records - result type should be target record's mapping type or IEquatable<T> collection.

By default associations are used only for joins generation in LINQ queries and will have null value for loaded records. To load data into association, you should explicitly specify it in your query using LoadWith<TEntity, TProperty>(IQueryable<TEntity>, Expression<Func<TEntity, TProperty?>>) method.

AssociationDescriptor

Stores association descriptor.

ColumnAliasAttribute

Specifies that current field or property is just an alias to another property or field. Currently this attribute has several issues:

  • you can apply it to class or interface - such attribute will be ignored by linq2db;
  • it is possible to define attribute without setting MemberName value;
  • you can define alias to another alias property or field and potentially create loop.
ColumnAttribute

Configures mapping of mapping class member to database column. Could be applied directly to a property or field or to mapping class/interface. In latter case you should specify member name using MemberName property.

ColumnDescriptor

Stores mapping entity column descriptor.

DataTypeAttribute

This attribute allows to override default types, defined in mapping schema, for current column. Also see DataType and DbType. Applying this attribute to class or interface will have no effect.

DynamicColumnAccessorAttribute

Configure setter and getter methods for dynamic columns.

DynamicColumnInfo

Discovers the attributes of a property and provides access to property metadata.

DynamicColumnsStoreAttribute

Marks target member as dynamic columns store.

EntityDescriptor

Stores mapping entity descriptor.

EntityMappingBuilder<TEntity>

Fluent mapping entity builder.

FluentMappingBuilder

Fluent mapping builder.

IdentityAttribute

Marks target column as identity column with value, generated on database side during insert operations. Identity columns will be ignored for insert and update operations with implicit column list like Insert<T>(IDataContext, T, string?, string?, string?, string?, TableOptions) or Update<T>(IDataContext, T, string?, string?, string?, string?, TableOptions) methods.

InheritanceMapping

Stores inheritance mapping information for single discriminator value.

InheritanceMappingAttribute

Defines to which type linq2db should map record based on discriminator value. You can apply this attribute to a base class or insterface, implemented by all child classes. Don't forget to define discriminator value storage column using IsDiscriminator.

LockedMappingSchema

Locked mapping schema.

MapValue

Stores enum mapping information for single enum value.

MapValueAttribute

Defines bidirectional mapping between enum field value, used on client and database value, stored in database and used in queries. Enumeration field could have multiple MapValueAttribute attributes.

Mapping from database value to enumeration performed when you load data from database. Linq2db will search for enumeration field with MapValueAttribute with required value. If attribute with such value is not found, you will receive LinqToDBException error. If you cannot specify all possible values using MapValueAttribute, you can specify custom mapping using methods like SetConvertExpression<TFrom, TTo>(Expression<Func<TFrom, TTo>>, bool, ConversionType).

Mapping from enumeration value performed when you save it to database or use in query. If your enum field has multiple MapValueAttribute attributes, you should mark one of them as default using IsDefault property.

MappingAttribute
MappingSchema

Mapping schema.

NotColumnAttribute

Marks current property or column to be ignored for mapping when explicit column mapping disabled. See IsColumnAttributeRequired.

NotNullAttribute

Sets nullability flag for current column to false. See NullableAttribute for more details.

NullableAttribute

Explicitly specifies that associated column could contain NULL values. Overrides default nullability flag from current mapping schema for property/field type. Has lower priority over CanBeNull. Using this attribute, you can allow NULL values for identity columns.

PrimaryKeyAttribute

Marks property or field as a member of primary key for current mapping type.

PropertyMappingBuilder<TEntity, TProperty>

Column or association fluent mapping builder.

QueryFilterAttribute

Contains reference to filter function defined by HasQueryFilter(Func<IQueryable<TEntity>, IDataContext, IQueryable<TEntity>>)

ResultSetIndexAttribute

Used to mark the index of a result set when multiple result sets need to be processed for a command.

ScalarTypeAttribute

Overrides default scalar detection for target class or structure. By default linq2db treats primitives and structs as scalar types. This attribute allows you to mark class or struct as scalar type or mark struct as non-scalar type. Also see IsStructIsScalarType. Note that if you marks some type as scalar, you will need to define custom mapping logic between object of that type and data parameter using SetConvertExpression(Type, Type, LambdaExpression, bool, ConversionType) methods.

SequenceNameAttribute

Specifies value generation sequence for mapped property of field. Currently it supported only for:

  • Firebird generators
  • Oracle sequences
  • PostgreSQL serial pseudotypes/sequences
SkipBaseAttribute

Abstract Attribute to be used for skipping values

SkipValuesByListAttribute

Abstract Attribute to be used for skipping value for SkipValuesOnInsertAttribute based on Insert or SkipValuesOnUpdateAttribute based on Update/> or a custom Attribute derived from this to override ShouldSkip(object, EntityDescriptor, ColumnDescriptor)

SkipValuesOnInsertAttribute

Attribute for skipping specific values on insert.

SkipValuesOnUpdateAttribute

Attribute for skipping specific values on update.

TableAttribute

Maps databse table or view to a class or interface. You can apply it to any class including non-public, nester or abstract classes. Applying it to interfaces will allow you to perform queries against target table, but you need to specify projection in your query explicitly, if you want to select data from such mapping.

ValueConverterAttribute

Interfaces

IColumnChangeDescriptor

Mapping entity column descriptor change interface.

IEntityChangeDescriptor

Mapping entity descriptor change interface.

Enums

SkipModification

Flags for specifying skip modifications used for Attributes based on SkipBaseAttribute.