代码3:我的Data Entity – 1,应用程序中的Data Entity
// MyCustomer:包含基本字段的Customer,支持数据列表,从MyDef继承
[Serializable()]
public class MyCustomer: MyDef
{
public string Id;
public string Name;
public string Phone;
public MyCustomer() { }
public MyCustomer(ArrayList al) : base(al) { }
}
// MyDef:提供当前应用程序所需的Data Entity支持,
// 包括O/R Mapping,XML,从DefBase继承
[Serializable()]
public class MyDef: DefBase, IList, IEnumerable
{
// O/R Mapping fields
[NonSerialized()]
protected internal ObjectSet _ostOrm = null;
...
// XML fields
[NonSerialized()]
protected internal XmlNode _xmlNode = null;
...
public MyDef() { }
public MyDef(ArrayList al) : base(al) { }
public MyDef(ObjectSet ostOrm)
{
this._ostOrm = ostOrm;
this._typeEntity =
MyEntityType.ORM_OBJECTSPACES_OBJECTSET;
}
public MyDef(XmlNode xmlNode)
{
this._xmlNode = xmlNode;
this._typeEntity = MyEntityType.XML_NODE;
}
...
}