Table of Contents

Class AssociationDescriptor

Namespace
LinqToDB.Mapping
Assembly
linq2db.dll

Stores association descriptor.

public class AssociationDescriptor
Inheritance
AssociationDescriptor
Extension Methods

Constructors

AssociationDescriptor(Type, MemberInfo, string[], string[], string?, Expression?, string?, Expression?, string?, string?, Expression?, bool?, string?)

Creates descriptor instance.

public AssociationDescriptor(Type type, MemberInfo memberInfo, string[] thisKey, string[] otherKey, string? expressionPredicate, Expression? predicate, string? expressionQueryMethod, Expression? expressionQuery, string? storage, string? associationSetterExpressionMethod, Expression? associationSetterExpression, bool? canBeNull, string? aliasName)

Parameters

type Type

From (this) side entity mapping type.

memberInfo MemberInfo

Association member (field, property or method).

thisKey string[]

List of names of from (this) key members.

otherKey string[]

List of names of to (other) key members.

expressionPredicate string

Optional predicate expression source property or method.

predicate Expression

Optional predicate expression.

expressionQueryMethod string

Optional name of query method.

expressionQuery Expression

Optional query expression.

storage string

Optional association value storage field or property name.

associationSetterExpressionMethod string

Optional name of setter method.

associationSetterExpression Expression

Optional setter expression.

canBeNull bool?

If true, association will generate outer join, otherwise - inner join.

aliasName string

Optional alias for representation in SQL.

Properties

AliasName

Gets alias for association. Used in SQL generation process.

public string? AliasName { get; }

Property Value

string

AssociationSetterExpression

Gets optional setter expression.

public Expression? AssociationSetterExpression { get; }

Property Value

Expression

AssociationSetterExpressionMethod

Gets optional setter method source property or method.

public string? AssociationSetterExpressionMethod { get; }

Property Value

string

CanBeNull

Gets join type, generated for current association. If true, association will generate outer join, otherwise - inner join.

public bool CanBeNull { get; }

Property Value

bool

ExpressionPredicate

Gets optional predicate expression source property or method.

public string? ExpressionPredicate { get; }

Property Value

string

ExpressionQuery

Gets optional query expression.

public Expression? ExpressionQuery { get; }

Property Value

Expression

ExpressionQueryMethod

Gets optional query method source property or method.

public string? ExpressionQueryMethod { get; }

Property Value

string

IsList

public bool IsList { get; }

Property Value

bool

MemberInfo

Gets association member (field, property or method).

public MemberInfo MemberInfo { get; }

Property Value

MemberInfo

OtherKey

Gets list of names of to (other) key members. Could be empty, if association has predicate expression.

public string[] OtherKey { get; }

Property Value

string[]

Predicate

Gets optional predicate expression.

public Expression? Predicate { get; }

Property Value

Expression

Storage

Gets optional association value storage field or property name. Used with LoadWith.

public string? Storage { get; }

Property Value

string

ThisKey

Gets list of names of from (this) key members. Could be empty, if association has predicate expression.

public string[] ThisKey { get; }

Property Value

string[]

Methods

GenerateAlias()

Generates table alias for association.

public string GenerateAlias()

Returns

string

Generated alias.

GetElementType(MappingSchema)

public Type GetElementType(MappingSchema mappingSchema)

Parameters

mappingSchema MappingSchema

Returns

Type

GetParentElementType()

public Type GetParentElementType()

Returns

Type

GetPredicate(Type, Type)

Loads predicate expression from ExpressionPredicate member.

public LambdaExpression? GetPredicate(Type parentType, Type objectType)

Parameters

parentType Type

Type of object that declares association

objectType Type

Type of object associated with expression predicate

Returns

LambdaExpression

null of association has no custom predicate expression or predicate expression, specified by ExpressionPredicate member.

GetQueryMethod(Type, Type)

Loads query method expression from ExpressionQueryMethod member.

public LambdaExpression? GetQueryMethod(Type parentType, Type objectType)

Parameters

parentType Type

Type of object that declares association

objectType Type

Type of object associated with query method expression

Returns

LambdaExpression

null of association has no custom query method expression or query method expression, specified by ExpressionQueryMethod member.

HasQueryMethod()

public bool HasQueryMethod()

Returns

bool

ParseKeys(string?)

Parse comma-separated list of association key column members into string array.

public static string[] ParseKeys(string? keys)

Parameters

keys string

Comma-separated (spaces allowed) list of association key column members.

Returns

string[]

Returns array with names of association key column members.