In these sample codes, BaseObject.cs, ICondition.cs, IPersistable.cs and ObjectCollection.cs are shared classes are for all Domain Objects. And IUserData.cs, UserData.cs and User.cs represent a Domain Object “User”, mapping to Table “User” in a RDB when using a RDB.
Sample Domain Object “User” and “ObjectCollection<User>” (C# 2.0 Generic Style Class) represent a single user and user’s collection. They are all inheriting IPersistable, so need to implementing “Save” and “Load” methods of IPersistable. Class “User” inherits BaseObject<UserData> which provides “User” the special custom batch Update support.
With the help of the following four methods, we can do all kinds of “Read” and “Write” to “User”: User.Save, User.Load, ObjectCollection<User>.Save, ObjectCollection<User>.Load and BaseObject<UserData>.BatchUpdate.
And with the benefit of C# 2.0’s Generic, codes become more clearly than un-generic style implementing.
IUserData.csUserData.cs
IPersistable.cs
BaseObject.cs
ICondition.cs
User.cs
ObjectCollection.cs
//The End