Class CustomTableRow<TTableInfo>
Inherited Members
Namespace: SuperOffice.CRM.Rows
Assembly: SoDataBase.dll
Syntax
public class CustomTableRow<TTableInfo> : TableRowBase, INestedPersist, ISoDataLookup, ISentryIgnorable where TTableInfo : TableInfo
Type Parameters
| Name | Description |
|---|---|
| TTableInfo |
Constructors
CustomTableRow(CustomTableRowIdxBase)
Constructor for the class taking an index as argument. This class can take any table based on a TableInfo object
Declaration
protected CustomTableRow(CustomTableRow<TTableInfo>.CustomTableRowIdxBase idx)
Parameters
| Type | Name | Description |
|---|---|---|
| CustomTableRow<TTableInfo>.CustomTableRowIdxBase | idx | The index representing a SELECT command to the database. |
Properties
InnerFieldValuePairs
Container for the fields and values that belong to the current sql-command.
Declaration
protected override ArgumentParameterCollection InnerFieldValuePairs { get; }
Property Value
| Type | Description |
|---|---|
| ArgumentParameterCollection |
Overrides
InnerPrimaryKey
The primary key needed to decide which specific row to alter with the current sql-command.
Declaration
protected override FieldInfo InnerPrimaryKey { get; }
Property Value
| Type | Description |
|---|---|
| FieldInfo |
Overrides
InnerPrimaryKeyValue
The actual value the primary key must have.
Declaration
protected override Parameter InnerPrimaryKeyValue { get; }
Property Value
| Type | Description |
|---|---|
| Parameter | The inner primary key value. |
Overrides
IsDirty
Is the row dirty, e.g. been modified since the last time it was saved to the database.
Declaration
public override bool IsDirty { get; }
Property Value
| Type | Description |
|---|---|
| bool |
Overrides
IsNew
Is the row new, e.g. not been inserted to the database?
Declaration
public override bool IsNew { get; }
Property Value
| Type | Description |
|---|---|
| bool |
Overrides
this[string]
Get or set a value based on the name of the field.
Declaration
public override object this[string fieldName] { get; set; }
Parameters
| Type | Name | Description |
|---|---|---|
| string | fieldName | Name of the field in the database |
Property Value
| Type | Description |
|---|---|
| object | Value of the field. |
Overrides
TableInfo
Declaration
public override TableInfo TableInfo { get; }
Property Value
| Type | Description |
|---|---|
| TableInfo |
Overrides
Methods
GetFromPrimaryKeyAsync(TTableInfo, int, CancellationToken)
Retrieves a CustomTableRow from the custom table based on the specified TableInfo and primary key.
Declaration
public static Task<CustomTableRow<TTableInfo>> GetFromPrimaryKeyAsync(TTableInfo tableInfo, int primaryKey, CancellationToken cancellationToken = default)
Parameters
| Type | Name | Description |
|---|---|---|
| TTableInfo | tableInfo | The TableInfo describing the table from which the row will be retrieved. |
| int | primaryKey | The Primary Key of the row to retrieve. |
| CancellationToken | cancellationToken |
Returns
| Type | Description |
|---|---|
| Task<CustomTableRow<TTableInfo>> | CustomTableRow based on the specified TableInfo and primary key. |
InternalSetValue(string, object)
Declaration
protected override void InternalSetValue(string fieldName, object value)
Parameters
| Type | Name | Description |
|---|---|---|
| string | fieldName | |
| object | value |
Overrides
OnLoad(SoDataReader, TableInfo)
Called when data is read from the database, to fill the road with appropriate data.
Declaration
protected override void OnLoad(SoDataReader reader, TableInfo tableInfo)
Parameters
| Type | Name | Description |
|---|---|---|
| SoDataReader | reader | SoDataReader holding the data returned from the database. |
| TableInfo | tableInfo | The TableInfo used for the SELECT statement. |
Overrides
Reset()
Reset the changes made on the object.
Declaration
protected override void Reset()
Overrides
Remarks
If the row is not persisted to the database (e.g. IsNew is true), all the values will be reset. If the row has been persisted to or loaded from the database, the properties will be set to those of the last persisted or loaded values.
SetDefaultsAsync(DefaulterStrategy, CancellationToken)
Set default values for the row.
Declaration
public override Task SetDefaultsAsync(DefaulterStrategy strategy, CancellationToken cancellationToken = default)
Parameters
| Type | Name | Description |
|---|---|---|
| DefaulterStrategy | strategy | Strategy used when applying default values; values depend on where we are in the Create/Fetch/Populate/Save cycle |
| CancellationToken | cancellationToken |
Returns
| Type | Description |
|---|---|
| Task |
Overrides
SetPrimaryKey(int)
Declaration
protected override void SetPrimaryKey(int primaryKey)
Parameters
| Type | Name | Description |
|---|---|---|
| int | primaryKey |
Overrides
Validate(RowValidator)
Validate this row.
Declaration
public override void Validate(RowValidator rowValidator)
Parameters
| Type | Name | Description |
|---|---|---|
| RowValidator | rowValidator | RowValidator for inserting the result of the validation |