Multi-layer multi-database mode Development Experiment (2) Entity

Source: Internet
Author: User

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.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.