An object class is the representation of an object in the system. It runs through the entire architecture and bears the responsibility of transferring data between different layers and modules. In many cases, the entity class and the tables in the database (this refers to the entity table, excluding the corresponding Relational Tables) are one-to-one. However, this is not a limitation. In complex database design, an entity class may correspond to multiple tables or cross-maps. In this experiment, the object class corresponds to the table one by one, and the attributes in the object class correspond to the fields in the table.
User object
Code
Using system;
Using system. Collections. Generic;
Using system. LINQ;
Using system. text;
Namespace MWC. Entity
{
Public class user
{
Public user ()
{
_ Userid = guid. newguid ();
_ Username = "autocreate ";
_ Loginuid = "Auto" + system. datetime. now;
_ Loginpwd = "";
}
Private guid _ userid;
Public guid userid
{
Get {return _ userid ;}
Set {_ userid = value ;}
}
Private string _ username;
Public String Username
{
Get {return _ username ;}
Set {_ username = value ;}
}
Private string _ loginuid;
Public String loginuid
{
Get {return _ loginuid ;}
Set {_ loginuid = value ;}
}
Private string _ loginpwd;
Public String loginpwd
{
Get {return _ loginpwd ;}
Set {_ loginpwd = value ;}
}
}
}
Department and group object group entity
Code
Using system;
Using system. Collections. Generic;
Using system. LINQ;
Using system. text;
Namespace MWC. Entity
{
Public class group
{
Public group ()
{}
Private guid _ groupid;
Public guid groupid
{
Get {return _ groupid ;}
Set {_ groupid = value ;}
}
Private string _ groupname;
Public String groupname
{
Get {return _ groupname ;}
Set {_ groupname = value ;}
}
}
}
The entity class will be placed under the MWC. entity project. As you can see, the entity class code is very simple. It is only responsible for Object Representation and data transmission, and does not contain any logic content.