The idea is to create an Object that inherits from DBObject, then set attributes to denote the table and the columns.
Example:
[DBTable("user")]
public class User : DBObject {
[DBColumn("first_name")]
public string FirstName
{
get { return (string)List["first_name"]; }
set
{
List["first_name"] = value;
_dirty = true;
}
}
}
DBObject would provide some automatic functions like .ByID which will return an object by it's key. Example: User myuser = User.ByID(1);
And .Update() Which will update all the Properties with an Attribute of DBColumn. But it only updates if the object has been marked as dirty (_dirty=true;)
I also want to add a .Select() that allows you to create your own queries. Since you define the object you can define whatever logic the object should have. This helps keep ASP.NET in M.V.C.
No comments:
Post a Comment