Table of Contents

Class RepeaterField

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

Represents a repeater field that is used to repeat a set of form components.

public class RepeaterField : TrinityField<RepeaterField, string>, ITrinityComponent, ITrinityField, IFormComponent, IHasSchema, IHasRelationship
Inheritance
RepeaterField
Implements
Inherited Members

Constructors

RepeaterField(string)

public RepeaterField(string columnName)

Parameters

columnName string

Properties

CanCreateItem

Gets or sets a value indicating whether the user can create items.

public bool CanCreateItem { get; set; }

Property Value

bool

true if the user can create items; otherwise, false.

CanDeleteItem

Gets or sets a value indicating whether the user can delete items.

public bool CanDeleteItem { get; set; }

Property Value

bool

true if the user can delete items; otherwise, false.

CanMoveItem

Gets or sets a value indicating whether the user can move items.

public bool CanMoveItem { get; set; }

Property Value

bool

true if the user can move items; otherwise, false.

ComponentName

The component name in the front-end side.

public override string ComponentName { get; }

Property Value

string

Fields

Gets or sets the dictionary of fields.

protected Dictionary<string, object> Fields { get; set; }

Property Value

Dictionary<string, object>

ForeignColumn

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

public string? ForeignColumn { get; set; }

Property Value

string

ForeignColumnName

Gets or sets the name of the foreign column in the database.

public string? ForeignColumnName { 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

ForeignTableName

Gets or sets the name of the foreign table in the database.

public string? ForeignTableName { 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

IsCollapsible

Gets or sets a value indicating whether the repeater field is collapsible.

public bool IsCollapsible { get; protected set; }

Property Value

bool

IsSavable

Whether the field should be saved into the database or not.

public override bool IsSavable { get; set; }

Property Value

bool

LocalColumnName

Gets or sets the name of the local column in the database.

protected string? LocalColumnName { get; set; }

Property Value

string

RelationshipName

The name of the relationship.

public string? RelationshipName { get; set; }

Property Value

string

Schema

Gets or sets the schema for the component.

public List<object>? Schema { get; set; }

Property Value

List<object>

Remarks

The schema can be a list of objects of any ITrinityComponent.

Methods

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 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

PrepareForValidation(IValidator, IReadOnlyDictionary<string, object?>, ModelStateDictionary)

Prepares the field for validation.

public override void PrepareForValidation(IValidator validator, IReadOnlyDictionary<string, object?> form, ModelStateDictionary modelState)

Parameters

validator IValidator

The validator to use.

form IReadOnlyDictionary<string, object>

The form to validate.

modelState ModelStateDictionary

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 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

SetAsCollapsible(bool)

Sets a value indicating whether the repeater field is collapsible.

public RepeaterField SetAsCollapsible(bool isCollapsible = true)

Parameters

isCollapsible bool

The value indicating whether the repeater field is collapsible.

Returns

RepeaterField

The current instance of the RepeaterField.

SetCanCreateItem(bool)

Sets whether the user can create items.

public virtual RepeaterField SetCanCreateItem(bool can = true)

Parameters

can bool

Whether the user can create items.

Returns

RepeaterField

The RepeaterField instance.

SetCanDeleteItem(bool)

Sets whether the user can delete items.

public virtual RepeaterField SetCanDeleteItem(bool can = true)

Parameters

can bool

Whether the user can delete items.

Returns

RepeaterField

The RepeaterField instance.

SetCanMoveItem(bool)

Sets whether the user can move items.

public virtual RepeaterField SetCanMoveItem(bool can = true)

Parameters

can bool

Whether the user can move items.

Returns

RepeaterField

The RepeaterField instance.

SetRelationship(string, string, string)

Sets the relationship between the local column and the foreign column in the database.

public RepeaterField SetRelationship(string localColumnName, string foreignColumnName, string foreignTableName)

Parameters

localColumnName string

The name of the local column in the database.

foreignColumnName string

The name of the foreign column in the database.

foreignTableName string

The name of the foreign table in the database.

Returns

RepeaterField

The current instance of the RepeaterField.

SetSchema(List<IFormComponent>)

Sets the schema for the repeater field.

public RepeaterField SetSchema(List<IFormComponent> schema)

Parameters

schema List<IFormComponent>

The schema to set.

Returns

RepeaterField

The RepeaterField instance.