Table of Contents

Class PrimaryKeyAttribute

Namespace
LinqToDB.Mapping
Assembly
linq2db.dll

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

[AttributeUsage(AttributeTargets.Property|AttributeTargets.Field, AllowMultiple = true)]
public class PrimaryKeyAttribute : MappingAttribute, _Attribute
Inheritance
PrimaryKeyAttribute
Implements
Inherited Members
Extension Methods

Constructors

PrimaryKeyAttribute()

Creates attribute instance.

public PrimaryKeyAttribute()

PrimaryKeyAttribute(int)

Creates attribute instance.

public PrimaryKeyAttribute(int order)

Parameters

order int

Column order in composite primary key.

PrimaryKeyAttribute(string?, int)

Creates attribute instance.

public PrimaryKeyAttribute(string? configuration, int order)

Parameters

configuration string

Mapping schema configuration name. See LinqToDB.Configuration.

order int

Column order in composite primary key.

Properties

Order

Gets or sets 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. Default value: -1.

public int Order { get; set; }

Property Value

int

Methods

GetObjectID()

Returns mapping attribute id, based on all attribute options.

public override string GetObjectID()

Returns

string