Interface IOrpheusModule
- Namespace
- OrpheusInterfaces.Core
- Assembly
- OrpheusInterfaces.dll
OrpheusModule represents a logical division and grouping of a set of tables. For example you can an OrdersModule, which will be comprised from many different tables. Orders,Customers,OrderLines etc. When you Save from the module level, all pending records in tables that belong to the module, will be saved as well. All master-detail relationships and keys will be updated automatically.
public interface IOrpheusModule
Properties
Database
Module's database.
IOrpheusDatabase Database { get; }
Property Value
- IOrpheusDatabase
Module's database
Definition
Module's definition.
IOrpheusModuleDefinition Definition { get; }
Property Value
- IOrpheusModuleDefinition
Module's definition
MainTable
The module's main table.
IOrpheusTable MainTable { get; set; }
Property Value
- IOrpheusTable
Module's main table
ReferenceTables
List of module's reference tables. Reference tables are tables that are referenced from a module table, through a foreign key constraint.
List<IOrpheusTable> ReferenceTables { get; }
Property Value
- List<IOrpheusTable>
Module's reference tables
Tables
List of module's tables.
List<IOrpheusTable> Tables { get; }
Property Value
- List<IOrpheusTable>
Module's tables
Methods
ClearData()
Clears data from all module tables.
void ClearData()
GetReferenceTable<T>()
Gets a table by model. Uses the model class name as the table name.
IOrpheusTable<T> GetReferenceTable<T>()
Returns
- IOrpheusTable<T>
An instance of IOrpheusTable
T
Type Parameters
TModel type
GetReferenceTable<T>(int)
Gets a table by index, for a model.
IOrpheusTable<T> GetReferenceTable<T>(int index)
Parameters
indexintTable index
Returns
- IOrpheusTable<T>
An instance of IOrpheusTable
T
Type Parameters
TModel type
GetReferenceTable<T>(string)
Gets a table by name, for a model.
IOrpheusTable<T> GetReferenceTable<T>(string tableName)
Parameters
tableNamestringTable index
Returns
- IOrpheusTable<T>
An instance of IOrpheusTable
T
Type Parameters
TModel type
GetTable<T>()
Gets a table by model. Uses the model class name as the table name.
IOrpheusTable<T> GetTable<T>()
Returns
- IOrpheusTable<T>
An instance of IOrpheusTable
T
Type Parameters
TModel type
GetTable<T>(int)
Gets a table by index, for a model.
IOrpheusTable<T> GetTable<T>(int index)
Parameters
indexintTable index
Returns
- IOrpheusTable<T>
An instance of IOrpheusTable
T
Type Parameters
TModel type
GetTable<T>(string)
Gets a table by name, for a model.
IOrpheusTable<T> GetTable<T>(string tableName)
Parameters
tableNamestringTable name
Returns
- IOrpheusTable<T>
An instance of IOrpheusTable
T
Type Parameters
TModel type
Load(Dictionary<string, List<object>>, LogicalOperator, bool)
Loads records from the DB to the table. You can configure having multiple fields and multiple values per field. Multiple field values are bound with a logical OR. Multiple fields by default are bound with a logical OR. Defining a logical operator, you can change the default behavior. This applies only for the MainTable.
void Load(Dictionary<string, List<object>> keyValues, LogicalOperator logicalOperator = LogicalOperator.loOR, bool clearExistingData = true)
Parameters
keyValuesDictionary<string, List<object>>logicalOperatorLogicalOperatorclearExistingDatabool
Load(List<object>)
Loads a module's record from the database.
void Load(List<object> keyValues = null)
Parameters
Load(IDbCommand, bool)
Loads main table data by executing a db command.
void Load(IDbCommand dbCommand, bool clearExistingData = true)
Parameters
dbCommandIDbCommandclearExistingDatabool
Save()
Saves all changes to the database.
void Save()
Events
OnAfterSave
Occurs after the transaction has been commited.
event EventHandler<ISaveEventArguments> OnAfterSave
Event Type
OnBeforeSave
Occurs before records are save in the database.
event EventHandler<ISaveEventArguments> OnBeforeSave