Table of Contents

Class ScalarTypeAttribute

Namespace
LinqToDB.Mapping
Assembly
linq2db.dll

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.

[AttributeUsage(AttributeTargets.Class|AttributeTargets.Struct, AllowMultiple = true, Inherited = true)]
public class ScalarTypeAttribute : MappingAttribute, _Attribute
Inheritance
ScalarTypeAttribute
Implements
Inherited Members
Extension Methods

Constructors

ScalarTypeAttribute()

Creates attribute instance.

public ScalarTypeAttribute()

ScalarTypeAttribute(bool)

Creates attribute instance.

public ScalarTypeAttribute(bool isScalar)

Parameters

isScalar bool

Should target type be treated as scalar type or not.

ScalarTypeAttribute(string)

Creates attribute instance.

public ScalarTypeAttribute(string configuration)

Parameters

configuration string

Mapping schema configuration name. See LinqToDB.Configuration.

ScalarTypeAttribute(string, bool)

Creates attribute instance.

public ScalarTypeAttribute(string configuration, bool isScalar)

Parameters

configuration string

Mapping schema configuration name. See LinqToDB.Configuration.

isScalar bool

Should target type be treated as scalar type or not.

Properties

IsScalar

Gets or sets scalar type flag. Default value: true.

public bool IsScalar { get; set; }

Property Value

bool

Methods

GetObjectID()

Returns mapping attribute id, based on all attribute options.

public override string GetObjectID()

Returns

string