Class BelongsToField<T>
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
stringrelationTables
stringforeignColumnNames
stringforeignColumnToSelect
stringrelationshipName
string
BelongsToField(string, string, string?, string?)
public BelongsToField(string columnName, string foreignColumnToSelect, string? foreignTable = null, string? relationshipName = null)
Parameters
Properties
ComponentName
The component name in the front-end side.
public override string ComponentName { get; }
Property Value
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
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
QueryThe 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
QueryFactoryThe query factory used to create the query
value
stringThe value to search for, if any.
offset
intThe offset to use
search
stringThe 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
QueryThe 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
QueryFactoryThe query factory used to create the query
entities
List<IDictionary<string, object>>sort
SortThe 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>.