Table of Contents

Class ColumnDescriptorExtensions

Namespace
LinqToDB.Internal.Mapping
Assembly
linq2db.dll
public static class ColumnDescriptorExtensions
Inheritance
object
ColumnDescriptorExtensions

Methods

GetMemberAccessExpression(ColumnDescriptor, Expression)

Builds a member-access expression from instance to the CLR member this column is mapped to, following the dot-path in MemberName when the mapping is nested (e.g. o => o.Sub.Field).

public static Expression GetMemberAccessExpression(this ColumnDescriptor descriptor, Expression instance)

Parameters

descriptor ColumnDescriptor
instance Expression

Returns

Expression

Remarks

Unlike GetGetterExpression(Expression), the result has no null-check block wrapping intermediate reference-type members, so it is suitable for SQL conversion. When instance's CLR type doesn't match the column's entity root (e.g. Merge().Using<TSource>() with TSource ≠ TTarget), the column's leaf member is looked up on the instance type by name. Dynamic columns ([DynamicColumnsStore] / Sql.Property<T>) resolve to a Sql.Property<T>(instance, name) call regardless of instance's type — the raw dynamic-column getter throws "Dynamic column getter is not to be called" and isn't SQL-convertible, whereas the Sql.Property shape both converts to a column reference and structurally matches a user x => Sql.Property<T>(x, name) selector after canonicalisation.

Exceptions

InvalidOperationException

Thrown when no matching member exists on instance's type.