Description and examples of data classes and their relationships

Used in the example chart:

data Class

All data classes inherit from the base DataObject, which provides basic manipulation:

public class SimpleDataObject:DataObject 
	{
		public SimpleDataObject()
		{
		}
	}

Attribute

The attributes of a UML class are written in the class private data member of the specified type with the attribute name and the appropriate property to get/set the value. Property is always virtual, but with any modifier.

public class SimpleDataObject:DataObject 
	{
		public SimpleDataObject()
		{
		}
		private string fName;
		private int fIntAttr;
		public virtual string Name {get{return fName;} set{fName=value;}}		
		public virtual int IntAttr {get{return fIntAttr;} set{fIntAttr=value;}}
	}

Master

Artisans Association is represented in the class member data of the appropriate type – craftsman class data, and similar property that is declared as virtual. Example:

private MasterDataObject fMaster;
public virtual MasterDataObject Master {get{return fMaster;} set{fMaster=value;}}

Detail

If the class is aggregated:

1.Generated property that specifies aggregator(hat). This property is marked with the attribute ICSSoft.STORMNET.DataObject.AgregatorAttribute. An example of a class data detail:

public class DetailDataObject:DataObject
	{
		public DetailDataObject()
		{
		}
		private string fStringAttr;
		public virtual string StringAttr {get{return fStringAttr;} set{fStringAttr=value;}}
		private SimpleDataObject fSimple;
		[Agregator]
		public virtual SimpleDataObject Simple {get{return fSimple;}set{fSimple=value;}}
}

2.Creates a class derived from DetailArray, providing basic operations on the array of data objects of the aggregated class. Introduces the operation of receiving a data object by key and by index, and adding an object. This is done in order to provide access to array by index, and add the object. An example of a class an array of data objects for a given class of data:

public class DetailArrayOfDetailDataObject:DetailArray 
	{
		public DetailArrayOfDetailDataObject(SimpleDataObject simpledataobject):base(typeof(DetailDataObject), simpledataobject)
		{
		}
		public DetailDataObject this[object key]	{get {return (DetailDataObject) GetByKey(key);} set {SetByKey(key,value);}}
		public DetailDataObject this[int index]
		{
			get 
			{
				return (DetailDataObject) ItemByIndex(index);
			}
		}
		public void Add(DataObject dataobject)
		{
			AddObject(dataobject);
		}	
	}

3.If the class is aggregating, dealova Association is represented in the object data member type of a class derived from DetailArray and similar property. Example:

private DetailArrayOfDetailDataObject fDetails;
public virtual DetailArrayOfDetailDataObject Details {get{return fDetails;} set{fDetails=value;}}

An example is also available [at] (https://github.com/Flexberry/FlexberryORM-DemoApp/tree/master/FlexberryORM/CDLIB/Objects).

Inheritance

If the class is legacy, the source code he inherited from the corresponding parent (in accordance with the diagram). If the inherited class has the attribute (detail, master) with the same name as the ancestor, it is overloaded. Cannot change type. The operation of a UML class generated by virtual methods .Net-class. Methods can also be overloaded in the descendants, for which the heir must be specified a method with the same number and type of parameters.

Переведено сервисом «Яндекс.Переводчик» http://translate.yandex.ru