Interface ITrinityField
- Namespace
- AbanoubNassem.Trinity.Components.Interfaces
- Assembly
- AbanoubNassem.Trinity.dll
Represents a field in a TrinityForm.
public interface ITrinityField
Properties
ColumnName
Gets or sets the name of the column associated with the field.
string ColumnName { get; set; }
Property Value
IsSavable
Whether the field should be saved into the database or not.
[JsonIgnore]
bool IsSavable { get; set; }
Property Value
OnlyOnCreate
Gets or sets a value indicating whether the field should be used only during creation.
bool OnlyOnCreate { get; set; }
Property Value
OnlyOnUpdate
Gets or sets a value indicating whether the field should be used only during updates.
bool OnlyOnUpdate { get; set; }
Property Value
Methods
Fill(ref Dictionary<string, object?>, IReadOnlyDictionary<string, object?>?)
Fills a form with data from a record for the field.
void Fill(ref Dictionary<string, object?> form, IReadOnlyDictionary<string, object?>? oldRecord = null)
Parameters
form
Dictionary<string, object>The form to fill.
oldRecord
IReadOnlyDictionary<string, object>The old record to use for the field.
FilterQuery(Query, string)
Adds a filter query for the field to a query builder.
void FilterQuery(Query query, string search)
Parameters
query
QueryThe query builder to use.
search
stringThe search term to use.
Format(ref IDictionary<string, object?>)
Formats a record for the field, after it is retrieved from the database, but before it is sent to the Trinity front-end.
void Format(ref IDictionary<string, object?> record)
Parameters
record
IDictionary<string, object>The record to format.
GetDeserializationType()
Gets the deserialization type for the field, to be deserialized from JSON.
Type GetDeserializationType()
Returns
- Type
The deserialization type for the field.
PrepareForValidation(IValidator, IReadOnlyDictionary<string, object?>, ModelStateDictionary)
Prepares the field for validation.
void PrepareForValidation(IValidator validator, IReadOnlyDictionary<string, object?> form, ModelStateDictionary modelState)
Parameters
validator
IValidatorThe validator to use.
form
IReadOnlyDictionary<string, object>The form to validate.
modelState
ModelStateDictionaryThe model state to use.
SelectQuery(Query)
Adds a select query for the field to a query builder.
void SelectQuery(Query query)
Parameters
query
QueryThe query builder to use.
SetFilterQueryUsing(Action<Query, string>)
Sets the filter query for the field using a callback function.
void SetFilterQueryUsing(Action<Query, string> filter)
Parameters
SetSelectQueryUsing(Action<Query>)
Sets the select query for the field using a callback function.
void SetSelectQueryUsing(Action<Query> query)
Parameters
query
Action<Query>The callback function to use.