Before we get too more involved with the engine, Let's take a look at the IDataObject hierarchy.

IDataObject is the base interface of IBrokeredDataObject that describes the contract for every object served by the Norman engine.
IBrokeredDataObject also inherits from IDisposable, and contains an instance of the IModelModifiedBroker contract. I shall talk about this interface in the next post. These interfaces form the core of any object that needs to be served by the engine.
public interface IDataObject
{
bool ObjectInitialised(Dictionary<string, object> parameters);
bool ObjectReconstructed(IDbDataObjectRow row);
IDbDataObjectRow Row{ get; set; }
Enum DataObjectType { get; set; }
bool ObjectIsNew { get; set; }
bool ObjectIsDeleted { get; set; }
bool ObjectIsModified { get; set; }
string DataObjectName { get; set; }
string TableName { get; set; }
string NameColumnName { get; set; }
string KeyColumnName { get; set; }
}
|
This interface has 2 functions and 9 properties. As we can see below, when implementing the interface, all the properties are recommended to remain as automatic properties, for use by the engine only. Therefore there are only two functions that require implementing on this interface, and they primarily deal with constructor logic. Simplicity itself :).
Functions
- bool ObjectInitialised(Dictionary<string, object> parameters);
The Create<T> method of the engine has two constraints on it, where T : IBrokeredDataObject, new().
As the new() constraint cannot be set to contain parameters, the ObjectInitialised function can be treated as an honourary constructor that can be passed parameters. As a side note, as I am Australian, 'Initialised' is spelt correctly. The parameter Dictionary object is passed from the Dictionary object parameter of the Create<T> function.
- bool ObjectReconstructed(IDbDataObjectRow row);
This function is called by the engine directly after an object has been loaded from the datastore. All data-mapping is handled by the engine, so this method need not include that functionality. It may be used for such operations such as loading a complex property who's value is calculated from stored values.
Properties
- IDbDataObjectRow Row{ get; set; }
This property is an internal representation of the ADO.NET DataRow that represents that data that will describe the object in the datastore.
This property should be left as an automatic get; set; property.
- bool ObjectIsNew { get; set; }
This property is used by the engine during persistance.
This property should be left as an automatic get; set; property.
- bool ObjectIsModified { get; set; }
This property is used by the engine during persistance.
This property should be left as an automatic get; set; property.
- bool ObjectIsDeleted { get; set; }
This property is used by the engine during persistance.
This property should be left as an automatic get; set; property.
- string DataObjectName { get; set; }
This property is used by internally the engine. It is the name of the instance of the object.
This property should be left as an automatic get; set; property.
- string TableName { get; set; }
This property is used by internally the engine. It is the name of the table that the object is persisted to in the datastore.
This property should be left as an automatic get; set; property.
- string NameColumnName { get; set; }
This property is used by internally the engine. It is the name of the column that stores the name of the object in the datastore.
This property should be left as an automatic get; set; property.
- string KeyColumnName { get; set; }
This property is used by internally the engine. It is the name of the column that is the key of the table that the object is persisted to.
This property should be left as an automatic get; set; property.
