The DatabaseObject type exposes the following members.

Constructors

  Name Description
Protected method DatabaseObject
Initializes a new DatabaseObject with the parent collection that this object is associated with.

Methods

  Name Description
Protected method Delete
Deletes the record from the database associated with this record. After which this object becomes invalid. The IsSaved property is automtically set to false. Performs the same function as IDatabaseObjects.ObjectDelete().
Public method Equals
Compares whether two objects are equal using the distinct values of each object. Specifically, true is returned if the distinct values match, both objects are not Nothing and both object types are the same.
(Overrides Object..::..Equals(Object).)
Protected method Finalize
Allows an Object to attempt to free resources and perform other cleanup operations before the Object is reclaimed by garbage collection.
(Inherited from Object.)
Protected method GetFieldValue
Gets and returns the field value from the database record associated with this object. Returns DBNull.Value if the field is NULL.
Public method GetHashCode
Serves as a hash function for a particular type.
(Inherited from Object.)
Public method GetType
Gets the Type of the current instance.
(Inherited from Object.)
Protected method Load(IDataReader)
Loads this object with the object's fields and properties with the fields from the database. Automatically sets the IDatabaseObject.DistinctValue and IDatabaseObject.IsSaved properties so that the object is correctly initialized. Onforwards a call to Database.ObjectLoad()
Protected method Load(SQLFieldValues)
Loads this object with the object's fields and properties with the fields from the database. Automatically sets the IDatabaseObject.DistinctValue and IDatabaseObject.IsSaved properties so that the object is correctly initialized. Onforwards a call to Database.ObjectLoad()
Protected method LoadFields
Sets the properties and fields marked with the FieldMappingAttribute with the values from the database record. Properties or fields that are an enum data type are automatically converted from the database integer value to the equivalent enum. For properties and fields marked with the FieldMappingObjectHookAttribute the property's or field's object is also traversed for properties or fields marked with the FieldMappingAttribute. Loads the lowest order base class that does not exist in the DatabaseObjects assembly first up through to the highest order class. This function should generally not be called from an inheritor. Use LoadFieldValues() to correctly load this object from a set of field values.
Protected method LockRecord
Locks the database record associated with this object by selecting and locking the row in the database. Supported in Microsoft SQLServer, Pervasive and MySQL. The record lock is released when the transaction is committed or rolled back. Throws an exception if not in transaction mode. Returns the field values from the record that has been locked.
Protected method MemberwiseClone
Creates a shallow copy of the current Object.
(Inherited from Object.)
Protected method MemberwiseCopy(DatabaseObject)
Performs a shallow memberwise copy of fields in this and all base classes, but does not copy any of the DatabaseObjects fields ensuring that the objects are not considered equal.
Protected method MemberwiseCopy(DatabaseObject, Boolean)
Performs a shallow memberwise copy of fields in this and all base classes, but does not copy any of the DatabaseObjects fields ensuring that the objects are not considered equal.
Protected method RootContainer<(Of <<'(TRootContainer>)>>)
Returns the root container object that this object is a child of.
Protected method Save
Extracts the fields to save to the database from the objItem.SaveFields function. The fields are then written to the database using either an SQL INSERT or UPDATE depending on whether the object has already been saved. If the collection has implemented IDatabaseObjects.KeyFieldName then objItem's key is also validated to ensure it is not null and unique within the collection. If the parent collection has implemented Subset then this object should exist within the parent collection. If not, a duplicate key error may occur if the key is being used in another subset in the same table. If a record is being amended (MyBase.IsSaved is True) then the function will "AND" the parent collection's Subset conditions and the DistinctValue value to create the WHERE clause in the UPDATE statement. Therefore, the combination of the IDatabaseObjects.Subset and IDatabaseObject.DistinctValue conditions MUST identify only one record in the table. Otherwise multiple records will be updated with the same data. If data is only inserted and not amended (usually a rare occurance) then this requirement is unnecessary.
Protected method SaveFields
Gets the values from the properties and fields marked with the FieldMappingAttribute to be saved to the database. Properties or fields that return an enum data type are automatically converted from the enum to the equivalent integer value for database storage. For properties and fields marked with the FieldMappingObjectHookAttribute the property's or field's object is also traversed for properties or fields marked with the FieldMappingAttribute.
Protected method SetFieldValue
Sets the field value for the database record associated with this object.
Public method ToString
Returns a String that represents the current Object.
(Inherited from Object.)

Operators

  Name Description
Public operator Static member Equality(DatabaseObject, DatabaseObject)
Compares whether two objects are equal using the distinct values of each object. Specifically, true is returned if the distinct values match, both objects are not Nothing and both object types are the same.
Public operator Static member Equality(DatabaseObject, IDatabaseObject)
Compares whether two objects are equal using the distinct values of each object. Specifically, true is returned if the distinct values match, both objects are not Nothing and both object types are the same.
Public operator Static member Equality(IDatabaseObject, DatabaseObject)
Compares whether two objects are equal using the distinct values of each object. Specifically, true is returned if the distinct values match, both objects are not Nothing and both object types are the same.
Public operator Static member Inequality(DatabaseObject, DatabaseObject)
Compares whether two objects are not equal using the distinct values of each object. Specifically, true is returned if the distinct values do not match, an object is Nothing or both object types are not the same.
Public operator Static member Inequality(DatabaseObject, IDatabaseObject)
Compares whether two objects are not equal using the distinct values of each object. Specifically, true is returned if the distinct values do not match, an object is Nothing or both object types are not the same.
Public operator Static member Inequality(IDatabaseObject, DatabaseObject)
Compares whether two objects are not equal using the distinct values of each object. Specifically, true is returned if the distinct values do not match, an object is Nothing or both object types are not the same.

Properties

  Name Description
Protected property DistinctValue
Returns the distinct value that uniquely identifies this object in the database. If a new object is saved or an existing object is loaded then this property is automatically set by the library. Typically, this is the value of an identity or auto increment database field.
Protected property GrandParent
Returns the grand parent of this object. This is usually the object that contains the collection that this object is contained with in. For example, a GrandParent object of an InvoiceDetail would be an Invoice.
Protected property GrandParentDistinctValue
Returns the distinct value from the grand parent of this object. This is usually the object that contains the collection that this object is contained within. For example, a GrandParent object of an InvoiceDetail would be an Invoice.
Protected property IsSaved
Returns whether this object has been saved to the database. If a new object is saved (which uses an auto increment field) or an existing object is loaded then this property is automatically set to true by the library.
Protected property ParentCollection
Sets/returns the parent collection (DatabaseObjects instance) that this object is associated with.
Protected property ParentDatabase
Returns the database associated with this object.

See Also