[Missing <summary> documentation for "N:DatabaseObjects"]


  Class Description
Public class ConnectionScope
Facilitates automatically opening and closing a connection. Implements IDisposable so that the construct can be used with a Using construct.
Public class Database
Represents a database connection and provides a set of functions that work in conjunction with classes implementing IDatabaseObjects and IDatabaseObject. The Database class automatically generates and executes the required SQL statements to perform common database operations such as saving, deleting searching etc. based on the values returned via the IDatabaseObjects and IDatabaseObject interfaces. Typically, this class is only used when explicitly implementing the IDatabaseObjects and IDatabaseObject interfaces rather than inheriting from DatabaseObjects (or DatabaseObjectsEnumerable) and DatabaseObject.
Public class Database..::..ConnectionController
Public class Database..::..TransactionsClass
Provides a mechanism for starting beginning, commiting and rolling back transactions.
Public class DatabaseObject
Represents a single database record. Implements IDatabaseObject and provides the basic plumbing code required for the interface. Mapping of fields from the database record to the fields in the inheriting class can be defined by using the FieldMappingAttribute.
Public class DatabaseObjectLockable
Extends the capabilities of the DatabaseObject by providing a set of routines that lock and unlock this object for exclusive access for a particular user. When Lock() is called a record is written to the lock table which includes the object's associated table name, the object's distinct value and the user ID specified in the DatabaseObjectLockController. When Unlock() is called this record is deleted. If another or the current user has locked the object then the IsLocked property will return true. The DatabseObjects library does not inhibit the loading and/or saving of any locked objects.
Public class DatabaseObjectLockController
This is the controller class that initializes the lock table and the user ID that is to be associated with all locking operations. In most situations, only one instance of this class is ever created and this instance is passed into the constructor for all DatabaseObjectLockable and DatabaseObjectUsingAttributesLockable instances.
Public class DatabaseObjects
Represents a collection of database records. Implements IDatabaseObjects and provides the basic plumbing code required for the interface. Attributes can be used to specify the database specific information using class attributes DistinctFieldAttribute, TableAttribute, KeyFieldAttribute, ItemInstanceAttribute, OrderByAttribute, SubsetAttribute and TableJoinAttribute.
Public class DatabaseObjectsEnumerable
Extends DatabaseObjects and implements the IEnumerable interface, therefore providing support for the "For Each" construct.
Public class DatabaseObjectsUsingAttributes Obsolete.
This class is deprecated. Use DatabaseObjects.DatabaseObjects instead, it provides the same functionality.
Public class DatabaseObjectsVolatile
This class extends DatabaseObjects by storing all objects associated with this DatabaseObjects collection in memory. Any objects added via VolatileObjectAdd() or VolatileObjectDelete() only affect the memory list until VolatileObjectsSave() is called. VolatileObjectsSave() will delete any objects flagged for deletion via VolatileObjectDelete() and then save any pre-loaded or newly added objects via VolatileObjectsAdd() to the database. Item objects can implement IDatabaseObjectVolatile to override the default saving behaviour of VolatileObjectsSave().
Public class DatabaseObjectsVolatileUsingAttributes Obsolete.
This class is deprecated. Use DatabaseObjects.DatabaseObjectsVolatile instead, it provides the same functionality.
Public class DatabaseObjectUsingAttributes Obsolete.
This class is deprecated. Use DatabaseObjects.DatabaseObject instead, it provides the same functionality.
Public class DatabaseObjectUsingAttributesHelper
Populates all fields and properties marked with the FieldMapping and FieldMappingObjectHook attributes with a set of
Public class DatabaseObjectUsingAttributesLockable Obsolete.
This class is deprecated. Use DatabaseObjects.DatabaseObjectLockable instead, it provides the same functionality.
Public class DistinctFieldAttribute
Specifies the field name that uniquely identifies each object within the collection. Typically, this is the field name of an identity or auto increment field. If the SubSetAttribute has been specified then the strDistinctFieldName need only be unique within the subset not the entire table. The strDistinctFieldName and can be identical to the field name specified with a KeyField attribute. This attribute must be specified on a DatabaseObjects*UsingAttributes class. This attribute is used to implement the IDatabaseObjects.DistinctFieldName and IDatabaseObjects.DistinctFieldAutoIncrements functions.
Public class FieldMappingAttribute
The FieldMappingAttribute class is used to define a mapping between a database field and a class property. This attribute is used with the DatabaseObjectUsingAttributes class. This field can also be used for loading fields that are of type DatabaseObjects.ObjectReference or DatabaseObjects.Generic.ObjectReference.
Public class FieldMappingObjectHookAttribute
Used to mark a property or field that reference an object for which database fields need to be loaded. The referenced object then contain fields or properties marked with FieldMappingAttribute. The field must be marked on a reference type field not a value based field. This attribute is useful in situations where another class (usually an inner class) holds a reference to an object that contains additional properties that are stored in the same record as the main container class.
Public class ItemInstanceAttribute
Specifies the type of class instance that will represent each database record / object. The type must have a constructor with argument of type DatabaseObjects.DatabaseObjects. This is the same arguments that are required for a class that inherits from DatabaseObject. Alternatively, an empty constructor if available will be used. The type must implement IDatabaseObject or inherit from DatabaseObject. Using this attribute is logically equivalent to overridding the ItemInstance function.
Public class KeyFieldAttribute
The KeyFieldAttribute should specify the field name that uniquely identifies each object within the collection. As opposed to the ordinal/index position or distinct field, the key field provides another method of accessing a particular object within the collection. The key field must be unique within the collection. If the SubsetAttribute has been specified then the key field only needs to be unique within the subset, not the entire table. Specifying this attribute is optional.
Public class MicrosoftAccessDatabase
Public class MicrosoftSQLCompactEditionDatabase
Public class MicrosoftSQLServerDatabase
Public class MySQLDatabase
Public class ObjectReference
This class can be used to simplify the process of creating and returning late-bound IDatabaseObject or DatabaseObject objects. This is is particularly useful in decreasing load times of referenced objects by post-poning loading any objects until the property or method is called directly. The referenced object is only loaded on the first call to the Object property. Subsequent calls return the already loaded object. A variable of this type can be marked with the FieldMapping attribute so that the distinct values are automatically set and read by the library (this particular facility can only be used by an object that inherits from DatabaseObjectsUsingAttributes).
Public class ObjectReferenceEarlyBindingAttribute
Attribute for a field of type DatabaseObjects.Generic.ObjectReference class. Attribute cannot be applied to a DatabaseObjects.ObjectReference class - only the generic version. Indicates whether the foreign / referenced object should be loaded when the containing object is loaded (early binding). If ommitted then the late binding is applied. Specifically, only the reference object's distinct value will be assigned to the ObjectReference.DistinctValue property. Subsequent calls to ObjectReference.Object will load the foreign / referenced. Early binding is achieved by joining the table with the foreign table and creating the main object and the foreign / referenced object from the joined data. The table joins are created automatically and are automatically implemented in the DatabaseObjects.TableJoins function. ObjectReferenceEarlyBindingAttribute must be used with the FieldMappingAttribute to indicate the name of the field in the primary collection's table that references the foreign field / distinct value in the foreign collection. The field specified MUST link to the foreign collection's distinct field and table name as indicated by the TableAttribute and DistinctFieldAttribute values.
Public class OrderByFieldAttribute
The OrderByFieldAttribute should specify the field that is sorted and whether it is ascending or descending. If the TableJoinAttribute has been specified then the sort order can be specified on the joined table field. To further customer the ordering (i.e. sort by more than one field) simply override the OrderBy function and do not specify an OrderByAttribute. Specifying this attribute is optional and if not specified the table is not sorted.
Public class RootContainer
Public class SubsetAttribute
The SubsetAttribute class is used to indicate that the collection is a subset of the parent collection. The library uses the DatabaseObjects.Parent.DistinctValue property to determine the value to filter this table by using the field name specified in the attribute. For example if the collection was a set of InvoiceLines then the table would filter on the InvoiceID in the InvoicesLines table using the InvoiceID from the parent Invoice object. To further customer the subset (i.e. make it conditional) simply override the Subset function and do not specify a SubsetAttribute.
Public class TableAttribute
The TableAttribute class specifies the name of the database table that this collection is associated with. This attribute must be specified for all DatabaseObjects*UsingAttributes classes.
Public class TableJoinAttribute
The TableJoinAttribute indicates that this collection's table should be joined with another. This function is useful in optimising database loading speeds by allowing multiple tables to be joined into one data set. The resultant data set can then be used to load objects from the associated tables avoiding subsequent SQL calls. For a complete example, see the demonstration program. To further customer the subset (i.e. make it conditional) simply override the TableJoins function and do not specify a TableJoinAttribute.


  Interface Description
Public interface IDatabaseObject
An IDatabaseObject object represents a single record in a database table. The Database class provides the facility for classes implementing IDatabaseObject to copy data to and from the associated database record. Rather than directly implementing IDatabaseObject inherit from DatabaseObject as the DatabaseObject class provides the basic "plumbing" code required by IDatabaseObjects.
Public interface IDatabaseObjectLockable
Specifies the interface of all classes that are considered lockable by the library. See DatabaseObjectLockable, DatabaseObjectUsingAttributesLockable for further details.
Public interface IDatabaseObjects
An IDatabaseObjects object represents either a database table or a sub set of a database table. The Database class provides the facility for classes implementing IDatabaseObjects to specify the database table the class is bound to, how to identify each unique record within the table (or subset), how the table should be sorted and table joins (in order to improve performance). Rather than directly implementing IDatabaseObjects inherit from DatabaseObjects as the DatabaseObjects class provides the basic "plumbing" code required by IDatabaseObjects.
Public interface IDatabaseObjectsMultipleSubclass
Extends the functionality of IDatabaseObjects so that if a collection contains multiple subclasses of a particular class in the collection then the ItemInstanceForSubclass is used rather than ItemInstance to return the particular subclass to be created.
Public interface IDatabaseObjectVolatile
Applies to child objects of a DatabaseObjectsVolatile collection. Save is called for each child that implements IDatabaseObjectVolatile when DatabaseObjectsVolatile.VolatileObjectsSave() is called. This allows the object to determine when it is being saved and perform additional checking and validation if necessary.
Public interface IGlobalDatabaseObjects
The IGlobalDatabaseObjects interface aids in maintaining a class library's abstraction layer when external objects (objects outside of the class library) need to be used. For example, if we had two DLL class libraries, the first an Inventory class library that exposes, amongst other classes a collection of Product objects and the second library needs to use the Product objects provided by the Inventory library. In particular, it needs to be able to store and load a Product using it's distinct value (ProductID). So, rather than exposing a public function in the Inventory library to load a Product using it's distinct value (ProductID) the Products class can implement the IGlobalDatabaseObjects interface. Implementing this interface allows a product to be loaded from it's distinct value without exposing a public function - thereby maintaining a degree of abstraction between the two dlls. Conversely, the product's distinct value (ProductID) can be extracted by calling DirectCast(objProduct, IDatabaseObject).DistinctValue.


An example of using an external DLL that implements IGlobalDatabaseObjects: 

Dim objProduct As Product = DirectCast(objProducts, IGlobalDatabaseObjects).Object(1234)



  Enumeration Description
Public enumeration Database..::..ConnectionType