SQLINQ Class Library
(April 2015)
Using SQLINQ to transform UML to C#
|
The purpose of the repository is to keep track of all objects that are loaded in from calls to the database. The system keeps track of the transient objects and will return the current transient object first before reloading one from a database. More...
Static Public Member Functions | |
static void | ThrowUOWException (Exception aException, string aMessage, BaseClass aAffectedObject=null) |
static SQLiteConnection | GetTemporaryDatabaseConnection () |
Gets a connection to the database, remember to not persist the connection. Use a Using statement for more than one statement. More... | |
static void | InitializeRepository (string aFullPathToLibraryDatabase) |
Used to load a new database. When using it, make sure that all your internal objects have been flushed or you may run into issues where saving data from a previous database will give you erroneous results. More... | |
static void | ClearMemoryObjects () |
Clears the objects in memory. This is an routine is called after a new database is loaded. More... | |
static TCLASS | GetUOW< TCLASS > (int aOID) |
Gets the specified object from the unit of work of type T. More... | |
static void | AddUOW< TCLASS > (TCLASS aObject) |
Internal Method Exposed for others to use. Adds the specified object to the repository if it doesn't already exist. If you want to delete the existing object, you need to use Delete first, as Add silently ends if a duplicate exists. More... | |
static void | DeleteUOW< TCLASS > (TCLASS aObject) |
Internal Method Exposed for others to use. Deletes an object from the repository so that it can be reloaded from the database. More... | |
static void | AddReadFactory< TTABLE > (Func< IBaseTable, BaseClass > aMethod) |
Adds a factory method for a given type. When adding a factory this way, your method is guaranteed to receive an object of type "T". More... | |
static TCLASS | Factory< TTABLE, TCLASS > (IBaseTable aRow, bool aFailWithNull=true) |
Returns an object for a given table instance. If the obect has been cached in memory, that object is returned instead of retreving a fresh copy from the database. Use this method for single rows, there is an overload for a list of rows. More... | |
static IEnumerable< TCLASS > | Factory< TTABLE, TCLASS > (IEnumerable< TTABLE > aRows, bool aFailSilently=true) |
Allows an enumerated set of rows to be sent and transformed using factory methods that have been specified. If you pass this method a set of ROWS that it cannot transform then it will fail silently unless the second parameter is true. More... | |
static void | AddGetOIDMethod< TTABLE > (Func< int, IBaseTable > aGetMethod) |
Gets the method that is used to return a row for a given OID and type. More... | |
static TCLASS | GetByOID< TTABLE, TCLASS > (int aOID) |
Returns a table instance for the generic T with a given OID. If you haven't called AddGetOIDMethod with the methods returning table rows, this call will return a null. More... | |
static IEnumerable< TCLASS > | GetAllForeignKey< TTABLE, TCLASS > (string aQueryField, int aOID) |
Gets all the rows in a given table that match a foreign key OID. More... | |
static ValidationResult | Commit () |
Write all the dirty objects back to the database as a transaction. Unit of Work is extremely fast as compared to individual object saves. An object save locks the database, changes the rows, releases the database. A Unit Of Work, writes the changes out in memory, then writes changes to the database as a single set. More... | |
static void | RegisterUpdate (BaseClass aBaseClass) |
This method is called when ever the IsDirty flag changes from false to true. It allows a user to control the order in which a UnitOfWork writes the updates to the database. Enabling the proper sequencing of updates interspersed with inserts and deletes. More... | |
static bool | Save< TTABLE, TCLASS > (TTABLE aTableRow, TCLASS aObject) |
Method to Insert, Update or delete a row in the database. More... | |
Static Public Attributes | |
static ValidationResult | ValidationMessages = null |
Contains a set of messages generated by an Object's Validate() method, not null if generated. More... | |
Properties | |
static bool | IsInitialized [get] |
static bool | isUnitOfWorkCommit [get] |
If True, the SAVE is part of a Unit Of Work Commit. More... | |
static string | UnitOfWorkMessage [get] |
The message that was generated by your application during an object save. More... | |
static BaseClass | UnitOfWorkObject [get] |
The object affected by a failure. Could be null if not specified. More... | |
static bool | HasDatabase [get] |
The purpose of the repository is to keep track of all objects that are loaded in from calls to the database. The system keeps track of the transient objects and will return the current transient object first before reloading one from a database.
|
static |
Gets the method that is used to return a row for a given OID and type.
TTABLE |
aGetMethod |
TTABLE | : | IBaseTable |
|
static |
Adds a factory method for a given type. When adding a factory this way, your method is guaranteed to receive an object of type "T".
aMethod | A factory method accepting "T". |
T | Type of objects your method will transform. |
TTABLE | : | IBaseTable |
|
static |
Internal Method Exposed for others to use. Adds the specified object to the repository if it doesn't already exist. If you want to delete the existing object, you need to use Delete first, as Add silently ends if a duplicate exists.
aObject | The object to add. |
TCLASS | : | BaseClass |
|
static |
Clears the objects in memory. This is an routine is called after a new database is loaded.
|
static |
Write all the dirty objects back to the database as a transaction. Unit of Work is extremely fast as compared to individual object saves. An object save locks the database, changes the rows, releases the database. A Unit Of Work, writes the changes out in memory, then writes changes to the database as a single set.
The Unit Of Work uses the timing of the setting of the object's DIRTY flag to control the order that objects are written to the database. See the BaseClass.IsDirty flag description for more information.
|
static |
Internal Method Exposed for others to use. Deletes an object from the repository so that it can be reloaded from the database.
aObject | A object. |
T | The 1st type parameter. |
TCLASS | : | BaseClass |
|
static |
Returns an object for a given table instance. If the obect has been cached in memory, that object is returned instead of retreving a fresh copy from the database. Use this method for single rows, there is an overload for a list of rows.
TTABLE | |
TCLASS |
aRow | Database row to load. |
aFailWithNull | If TRUE (default), returns an null value if it cannot convert the row, otherwise, throws an argument exception. |
TTABLE | : | IBaseTable | |
TCLASS | : | BaseClass |
|
static |
Allows an enumerated set of rows to be sent and transformed using factory methods that have been specified. If you pass this method a set of ROWS that it cannot transform then it will fail silently unless the second parameter is true.
aRows | The rows in a table. |
aFileSilently | If TRUE, throws a ArgumentException for rows it cannot handle. |
TINPUT | A class implementing IBaseTable. |
TRESULT | A class whose base type is BaseClass. |
TCLASS | : | BaseClass | |
TTABLE | : | IBaseTable |
|
static |
Gets all the rows in a given table that match a foreign key OID.
TTABLE | Table class |
TCLASS | Domain class |
aQueryField | Field to query, such as ParentOID. |
aOID | The value for ParentOID |
TTABLE | : | IBaseTable | |
TTABLE | : | new() | |
TCLASS | : | BaseClass |
|
static |
Returns a table instance for the generic T with a given OID. If you haven't called AddGetOIDMethod with the methods returning table rows, this call will return a null.
TTABLE | : | IBaseTable | |
TCLASS | : | BaseClass |
|
static |
Gets a connection to the database, remember to not persist the connection. Use a Using statement for more than one statement.
The database.
|
static |
Gets the specified object from the unit of work of type T.
TCLASS | : | BaseClass |
|
static |
Used to load a new database. When using it, make sure that all your internal objects have been flushed or you may run into issues where saving data from a previous database will give you erroneous results.
aFullPathToLibraryDatabase |
|
static |
This method is called when ever the IsDirty flag changes from false to true. It allows a user to control the order in which a UnitOfWork writes the updates to the database. Enabling the proper sequencing of updates interspersed with inserts and deletes.
aBaseClass |
|
static |
Method to Insert, Update or delete a row in the database.
aTableRow | Row to update. |
aObject | The class this row is based upon. |
TTABLE | Type of table being modified. |
TCLASS | Type of class this table is based upon. |
TTABLE | : | IBaseTable | |
TCLASS | : | BaseClass |
|
static |
Contains a set of messages generated by an Object's Validate() method, not null if generated.
|
staticget |
If True, the SAVE is part of a Unit Of Work Commit.
|
staticget |
The message that was generated by your application during an object save.
|
staticget |
The object affected by a failure. Could be null if not specified.