Micro Project Practice (6): Business layer Code Analysis--The generation strategy of entity classes

Source: Internet
Author: User

In the previous article, we analyzed the base class entity of the entity class, and in this article we analyzed the entity classes based on the class.

Each entity class will have two files, we take blogclass as an example, the class contains two files: BlogClass.cs and BlogClass.designer.cs, this is very similar to the code generated by yourself, and, more conveniently, VS will automatically fold the two files, as shown.

In these two files, BlogClass.designer.cs contains all the generated code: Members, attributes, and so on, while BlogClass.cs contains only the definition of a class that we can use to fill in the code.

BlogClass.designer.cs's code is as follows.

  1:using System;
  2:using System.Collections.Generic;
  3:using System.Data.Linq;
  4:using System.Linq;
  5:using System.Text;
  6:7: Using Dongblog.common;
 8:9: namespace DongBlog.Business.Blogs: {one:///<summary> 12:///log Category:///</summary>
 14:public Partial class Blogclass: {#region ID and timestamp 17:18:private int _id = new_entity_id;
 19:private byte[] _timestamp = new byte[] {};     20:21:///<summary> 22:///obtained ID:///</summary> 24:public override int ID 25:
 {26:get {return _id;} :///<summary> 29:///time stamp:///</summary> 31:public override byte[] Ti
 Mestamp: {33:get {return _timestamp;}
 35:36: #endregion 37:38: #region member 39:40:private string _name;
 41:private string _description; 42:43: #endregion 44:45: #region Property 46:47:///<summary> 48:///Get or set name:///</summary> 50:public String name 51: {52:
 get {return _name;}
 53:set {_name = value;} ///<summary> 56:///Get or set description:///</summary> 58:public string Descripti
 On: {60:get {return _description}
 61:set {_description = value;} 63:64: #endregion 65:} 66:}

Related Article

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.