Table of Contents

Class BelongsToField<T>

Namespace
AbanoubNassem.Trinity.Fields
Assembly
AbanoubNassem.Trinity.dll

A class that represents a field-column in a table that has a relationship with another table.

public class BelongsToField<T> : HasRelationshipField<BelongsToField<T>, T>, ITrinityComponent, ITrinityField, IFormComponent, IHasRelationship

Type Parameters

T
Inheritance
BelongsToField<T>
Implements
Derived
Inherited Members

Constructors

BelongsToField(string, string, string, string, string)

public BelongsToField(string localColumnNames, string relationTables, string foreignColumnNames, string foreignColumnToSelect, string relationshipName)

Parameters

localColumnNames string
relationTables string
foreignColumnNames string
foreignColumnToSelect string
relationshipName string

BelongsToField(string, string, string?, string?)

public BelongsToField(string columnName, string foreignColumnToSelect, string? foreignTable = null, string? relationshipName = null)

Parameters

columnName string
foreignColumnToSelect string
foreignTable string
relationshipName string

Properties

ComponentName

The component name in the front-end side.

public override string ComponentName { get; }

Property Value

string

Options

Gets or sets the list of options for the field.

public List<KeyValuePair<string, string>>? Options { get; protected set; }

Property Value

List<KeyValuePair<string, string>>

The list of options for the field.

Type

Used on the front-end side to determine what type is the component , is it (field, columns , etc).

public override string Type { get; }

Property Value

string

Methods

FilterQuery(Query, string)

Adds a filter query for the field to a query builder.

public override void FilterQuery(Query query, string globalSearch)

Parameters

query Query

The query builder to use.

globalSearch string

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 override 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 query for the field to a query builder.

public override void SelectQuery(Query query)

Parameters

query Query

The query builder to use.

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 override Task<List<IDictionary<string, object?>>> SelectRelationshipQuery(QueryFactory queryFactory, List<IDictionary<string, object?>> entities, Sort? sort = null)

Parameters

queryFactory QueryFactory

The query factory used to create the query

entities List<IDictionary<string, object>>
sort Sort

The sorting object

Returns

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

A list of selected relationships

SetOptions(List<KeyValuePair<string, string>>)

Sets the list of options for the field.

public BelongsToField<T> SetOptions(List<KeyValuePair<string, string>> options)

Parameters

options List<KeyValuePair<string, string>>

The list of options to set.

Returns

BelongsToField<T>

The current instance of the BelongsToField<T>.