Table of Contents

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

string

IsSavable

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

[JsonIgnore]
bool IsSavable { get; set; }

Property Value

bool

OnlyOnCreate

Gets or sets a value indicating whether the field should be used only during creation.

bool OnlyOnCreate { get; set; }

Property Value

bool

OnlyOnUpdate

Gets or sets a value indicating whether the field should be used only during updates.

bool OnlyOnUpdate { get; set; }

Property Value

bool

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 Query

The query builder to use.

search string

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

The validator to use.

form IReadOnlyDictionary<string, object>

The form to validate.

modelState ModelStateDictionary

The model state to use.

SelectQuery(Query)

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

void SelectQuery(Query query)

Parameters

query Query

The 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

filter Action<Query, string>

The callback function to use.

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.