Object Model Generation

This generates an Object Model from a DataStore's Data Model, i.e. the ItemTypes, AttributeTypes and AssociationTypes.

The purpose of the generated Object Model is to make it easy to interface the various Windows GUI frameworks to a DataStore. The frameworks are typically Windows Forms or WPF on the Desktop, or XAML for Windows Runtime.

For each ItemType a class is generated. This class will have a property for each of its AttributeTypes and AssociationTypes. These properties return instances of classes that allow an Items Attributes and Associations to be manipulated.

PropertyChanged

DataStoreObject and ItemObject both implement IPropertyChanged. It provides notifications when an Attribute is changed, an Item is created or deleted, and when an Association is added or removed. It only provides notification if the action was explicitly performed by the Object Model. E.g Associations removed because an Item is deleted are not reported.

It also provides error notifications. Any exception thrown by code in the Object Model, is caught, PropertyChanged fired and then the exception re-thown. This is done as on some platforms exception do not propagate through the dat binding layers.

It provides the notification by sub-classing PropertyChangedEventArgs.

The Object Model code could be running on a thread different to that of the UI when the event is fired. So when a DataStoreObject is created a delegate can be provided that will fire the event on the correct thread. See Expenses sample.

Generated Classes

A class that inherits from DataStoreObject

This class represents a connection to a DataStore. It has methods that allow a DataStore to be opened and closed; transactions to be controlled; and collections of Items to be returned

A class for each of the ItemType that inherits from ItemObject

There is a different class for each of the ItemTypes in a DataStore. These classes all inherit from ItemObject. Also for each AttributeType and AssociationType of the ItemType the class has a property that returns a Attribute or Associations Class.

Attribute

Provides access to an Items Attribute.

Associations

Allows Associations to be added and removed.

Items

Allows Items to be retrieved and created.