Data entity Layer

Source: Internet
Author: User

The data entity layer is used to encapsulate the data structure of an entity class. It is generally used to map data tables or views of a database to describe objects that exist objectively in the business.
When designing the data entity layer, you generally have the following options.
1. DataSet
2. XML
3. Use XML as the data structure source to generate a Unified Business Entity class.
4. serializable business entity classes.
5. serializable business entity classes with General CRUD operations.
The first two are too simple to describe here.

The third type is to write a complex and Unified Business Entity class. This class mainly reads the specified XML file and generates the corresponding business entity class. Use common database tools to export the existing database structure as an XML file and place it in the specified location. The program reads the XML and generates the corresponding DataSet for operation. The advantage is that the program is completely isolated from the database and is only related to the corresponding XML file, so it is highly independent. The downside is that there are too many things to consider. It takes a lot of time to fully implement reusable components. In addition, the configuration management requirements are very strict, mainly in the XML and Database Consistency. If you forget to update XML after updating the database, you can imagine the consequences. In addition, the system overhead increases, which has a certain impact on performance. (For some examples on the internet, refer)

The fourth implementation method is relatively easy, but it usually requires a lot of work for projects. We recommend that you develop an automatic tool before project development to reduce the workload.
Example:

1ID # region ID
2 // field name
3 public const string FIELD_ID = "Id ";
4 // attributes
5 private int iId;
6 public int Id
7 {
8 get
9 {
10 return iId;
11}
12 set
13 {
14 iId = value;
15}
16}
17 # endregion ID

The fifth is to add basic CRUD operations to the fourth type.

If you have any better methods, please advise. Thank you.

 

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.