Objects
Objects
ObjectClass
Zetbox knows four kinds of Types, all derived from DataType:
ObjectClass | Type for Zetbox Object Classes |
Interface | Type for Zetbox Interfaces |
Enumeration | Type for Zetbox Enumerations |
CompoundObject | Type for Zetbox Object Classes |
DataType
This is the abstract base class for all Zetbox Types. It provides the necessary infrastructure to describe a Type.
public interface DataType
{
string Name;
string Description;
IList<Property> Properties;
ICollection<Method> Methods;
Icon DefaultIcon;
ICollection<InstanceConstraint> Constraints;
}
Name | The name of the DataType. Note that this name has to be a valid C# name. A Constraint protects this. |
Description | Each Type should have a description. This description is used for documentation purposes. |
Properties | Each Type can have Properties (except Enumeration) |
Methods | Each Type can have Methods (except Enumeration) |
DefaultIcon | Each DataType can have a default icon |
Constraints | A Constraint checks the validity of an instance. If any constraint throws an error nothing will be committed. |
ObjectClass
ObjectClass is the defining class for Zetbox Objects.
public interface ObjectClass : DataType
{
ObjectClass BaseObjectClass;
ICollection<Interface> ImplementsInterfaces;
string TableName;
bool IsAbstract;
bool IsFrozenObject;
bool IsSimpleObject;
ViewModelDescriptor DefaultViewModelDescriptor;
ControlKind RequestedKind;
ICollection<AccessControl> AccessControlList;
}
IsAbstract | The ObjectClass is marked as abstract |
IsSimpleObject | The ObjectClass is marked as a simple, non complex object. Set it to true for all classes that have no inheritance and less enough and simple properties to edit them in grids and/or lists. This will prevent all list view models from opening such an object directly. Also the ObjectBrowser will not provide any interface. |
Relation
A Relation defines the relationship between two Objects. Every Object can have zero or more Relations.
An example of a Relation is the relation between Project and Tasks. One Project can have zero or more Tasks. One Tasks must have a Project.
Modeling a relation
A Relation can be defined by creating an object of type Relation and two RelationEnd objects. This can be done by
- creating an Relation Object.
- invoking the Create Relation method on an ObjectClass instance.
RelationEnd objects will be created automatically.
Relations are edited in the Relation Editor. The Relation Editor is a custom FullObjectView created by us.
Attributes of a relation
A Relation has these attributes:
Description | A text property used to describe the current relation |
Module | The Module which is introducing the current relation |
Storage | The StorageType of the current relation |
Verb | A verb used to name the current relation. The verb is used in conjunction with the role names of the RelationEnd objects to model a unique relation name. This relation name will be used e.g. for the database FK Contraint name. |
A | The RelationEnd A of the current relation |
B | The RelationEnd B of the current relation |
A RelationEnd has these attributes:
AParent | Relation object if this RelationEnd is the A-Side of the current relation. Otherwise NULL |
BParent | Relation object if this RelationEnd is the B-Side of the current relation. Otherwise NULL |
HasPersistentOrder | Specifies that the list is ordered. Applies only to lists |
Multiplicity | The Multiplicity of the current RelationEnd |
Navigator | An optional Navigator |
RoleName | Name of the role of the current RelationEnd |
Type | ObjectClass to which the current RelationEnd points |
There are four StorageTypes defined:
MergeIntoA | The relation information is stored with the A-side database table |
MergeIntoB | The relation information is stored with the B-side database table |
Replicate | The relation information is stored on both sides of the relations database tables |
Separate | The relation information is stored in a separate database table |
There are three Multiplicities defined:
ZeroOrOne | Optional Element (zero or one) |
One | Required Element (exactly one) |
ZeroOrMore | Optional List Element (zero or more) |
1:n Relation
A Project can have zero or more Tasks. A Task may have one Project.
The Relation object would be:
Storage = MergeIntoB
Verb = has
The RelationEnd A object would be:
AParent = Relation
BParent = NULL
HasPersistentOrder = false
Multiplicity = ZeroOrOne. If a Task must have a Project then One.
Navigator = Navigator to Tasks. The result would be a collection of Tasks (ICollection<Task>)
RoleName = Project
Type = Task instance of type ObjectClass
The RelationEnd B object would be:
AParent = NULL
BParent = Relation
HasPersistentOrder = false
Multiplicity = ZeroOrMore
Navigator = Navigator to the parent Project. The result would be a reference to a Project
RoleName = Tasks
Type = Project instance of type ObjectClass
n:m Relation
A Project can have zero or more ProjectMembers. A ProjectMember can be assinged to zero or more Projects.
The Relation object would be:
Storage = Seperate
Verb = has
The RelationEnd A object would be:
AParent = Relation
BParent = NULL
HasPersistentOrder = true
Multiplicity = ZeroOrMore.
Navigator = = Navigator to Persons. The result would be a list of Persons (IList<Person>)
RoleName = Projects
Type = Person instance of type ObjectClass
The RelationEnd B object would be:
AParent = NULL
BParent = Relation
HasPersistentOrder = true
Multiplicity = ZeroOrMore
Navigator = = Navigator to the assigned Projects. The result would be a list of Projects (IList<Project>)
RoleName = Member
Type = Project instance of type ObjectClass
1:1 Relation
A Relation must have a RelationEnd A. A RelationEnd may have a AParent Relation if its a A ReleationEnd.
The Relation object would be:
Storage = MergeIntoA
Verb = hasA
The RelationEnd A object would be:
AParent = Relation
BParent = NULL
HasPersistentOrder = false
Multiplicity = ZeroOrOne
Navigator = = Navigator to RelationEnd. The result would be a reference to a RelationEnd
RoleName = Relation
Type = RelationEnd instance of type ObjectClass
The RelationEnd B object would be:
AParent = NULL
BParent = Relation
HasPersistentOrder = true
Multiplicity = One
Navigator = = Navigator to the assigned Relation. The result would be a reference to a Relation
RoleName = A
Type = Relation instance of type ObjectClass
Properties
public interface Property
{
string Name;
bool EditableInGrid;
}
Editable in Grid | This is an override for the inline editing behaviour for grid and list controls. The default behaviour is to evaluate if the referenced ObjectClass is a simple object or not. |