Table of Contents

Class TrinityHasRelationshipColumn<T>

Namespace
AbanoubNassem.Trinity.Components.TrinityColumn
Assembly
AbanoubNassem.Trinity.dll

An abstract class that represents a column in a table that has a relationship with another table.

public abstract class TrinityHasRelationshipColumn<T> : TrinityColumn<TrinityHasRelationshipColumn<T>, T>, ITrinityColumn, ITrinityComponent, IHasRelationship

Type Parameters

T

The type of the column

Inheritance
TrinityHasRelationshipColumn<T>
Implements
Derived
Inherited Members

Constructors

TrinityHasRelationshipColumn(string, string?, string?)

Initializes a new instance of the TrinityHasRelationshipColumn class with the specified column name, foreign column and foreign table.

protected TrinityHasRelationshipColumn(string columnName, string? foreignColumn = null, string? foreignTable = null)

Parameters

columnName string

The name of the column

foreignColumn string

The name of the foreign column

foreignTable string

The name of the foreign table

Properties

ForeignColumn

Gets or sets the name of the foreign column for the relationship.

public string? ForeignColumn { get; set; }

Property Value

string

ForeignTable

Gets or sets the name of the foreign table for the relationship.

public string? ForeignTable { get; set; }

Property Value

string

HasRelationshipByDefault

A boolean that indicates whether this column has a relationship by default.

public bool HasRelationshipByDefault { get; set; }

Property Value

bool

RelationshipName

The name of the relationship.

public string? RelationshipName { get; set; }

Property Value

string

Methods

Filter(Query, string)

Filters the data in this column according to the specified query and search term.

public override void Filter(Query filters, string search)

Parameters

filters Query
search string

The search term used for filtering.

GetAssociatesRelationshipQuery(QueryFactory, string?, int, string?)

A method that gets the associates relationship query using the specified queryFactory, value, offset, search string, and returns a list of the key-value pairs.

public virtual Task<List<KeyValuePair<string, string>>> GetAssociatesRelationshipQuery(QueryFactory queryFactory, string? value, int offset, string? search = null)

Parameters

queryFactory QueryFactory

The query factory used to create the query

value string

The value to search for, if any.

offset int

The offset to use

search string

The search string to use

Returns

Task<List<KeyValuePair<string, string>>>

A list of key-value pairs

SelectQuery(Query)

Adds a select clause for the current column to the specified query.

public override void SelectQuery(Query query)

Parameters

query Query

The query to modify.

SelectRelationshipQuery(QueryFactory, List<IDictionary<string, object?>>, Sort?)

A method that selects the relationship query using the specified queryFactory and list of records, returns a list of the selected relationships.

public abstract Task<List<IDictionary<string, object?>>> SelectRelationshipQuery(QueryFactory queryFactory, List<IDictionary<string, object?>> records, Sort? sort = null)

Parameters

queryFactory QueryFactory

The query factory used to create the query

records List<IDictionary<string, object>>

The list of records to select from

sort Sort

The sorting object

Returns

Task<List<IDictionary<string, object>>>

A list of selected relationships

SetForeignColumn(string)

Sets the name of the foreign column for the relationship.

public TrinityHasRelationshipColumn<T> SetForeignColumn(string value)

Parameters

value string

The name of the foreign column.

Returns

TrinityHasRelationshipColumn<T>

The current TrinityHasRelationshipColumn<T> instance.

SetForeignTable(string)

Sets the name of the foreign table for the relationship.

public TrinityHasRelationshipColumn<T> SetForeignTable(string value)

Parameters

value string

The name of the foreign table.

Returns

TrinityHasRelationshipColumn<T>

The current TrinityHasRelationshipColumn<T> instance.

SetRelationshipName(string)

Sets the name of the relationship associated with this column.

public TrinityHasRelationshipColumn<T> SetRelationshipName(string value)

Parameters

value string

The name of the relationship.

Returns

TrinityHasRelationshipColumn<T>

The current TrinityHasRelationshipColumn<T> instance.