Skip to content

DmRelationAttribute ​

Namespace: MJCZone.DapperMatic.DataAnnotations

Assembly: MJCZone.DapperMatic

Summary ​

Marks a property as a relation to another model's rows, never a column: one related row (<c>public Customer? Customer</c>) or many (<c>public List<OrderLine>? Lines</c>). Relations are filled only when a query asks (<c>Include</c>), and can be filtered on (<c>o => o.Lines!.Any(l => ...)</c>).

Inheritance ​

Base Class: Attribute

sealed public

Contents ​

Constructors (2) | Methods (6) | Properties (8)

Constructors ​

DmRelationAttribute ​

csharp
DmRelationAttribute()

DmRelationAttribute ​

Initializes a new instance of the DmRelationAttribute class, naming the foreign key property: this model's for one related row, the related model's for many.

csharp
DmRelationAttribute(string foreignKey)

Parameters ​

  • foreignKey (string) - The foreign key property.

Methods ​

MethodSummary
Equals
GetHashCode
Match
IsDefaultAttribute
GetType
ToString

Equals ​

csharp
Equals()

GetHashCode ​

csharp
GetHashCode()

Match ​

csharp
Match()

IsDefaultAttribute ​

csharp
IsDefaultAttribute()

GetType ​

csharp
GetType()

ToString ​

csharp
ToString()

Properties ​

ThisKeys ​

Gets this model's key properties, or null.

Type: string[]?

OtherKeys ​

Gets the related model's key properties, or null.

Type: string[]?

OtherValues ​

Gets the related rows' fixed values, as property and value pairs, or null.

Type: string[]?

ThisValues ​

Gets this model's fixed values, as property and value pairs, or null.

Type: string[]?

Condition ​

Gets the name of the condition member, or null.

Type: string?

Through ​

Gets the link model of a many-to-many relation, or null.

Type: Type?

ForeignKey ​

Gets the foreign key property named on its own, or null.

Type: string?

TypeId ​

Type: object