C # code file generation extension code file

Source: Internet
Author: User
Tags custom name

A friend who sees this headline may not understand what's going on, but it doesn't matter. Interested friends can first understand what ivssinglefilegenerator is used to do in the "Implementation of the custom Vssinglefilegenerator"; in Vs.net. Provides a ivssinglefilegenerator interface to easily generate ancillary files for project files, as mentioned in the previous article to automatically generate an attached C # code file based on an XML file; Of course, this ivssinglefilegenerator is not just for XML files, it can be random for any project files to generate satellite files you can just set the relevant custom tools in the file properties.

Why here I proposed in the code file on the basis of the regeneration of the relevant code-related files, why not directly in the original code file to write complete it; The reason is simple because the handwriting code is not faster than the computer, the most important reason is based on XML Ivssinglefilegenerator is not good in some way. This is based on code files as a code description template. Describe the problem encountered in the current situation with XML, In my data persistence layer, XML is used to combine ivssinglefilegenerator to generate related entity classes.

The content might be as follows:

<smarkdatamodels xmlns= "Http://SmarkData.cn/model.xsd" >
<class name= "Customer" table= "Vp_customer" >
<id name= "CustomerID" type= "System.Int64"/>
<property name= "UserName" type= "System.String" comment= "username"/>
<property name= "userpwd" type= "System.String" comment= "User password"/>
<property name= "CustomerType" type= "System.Int32" comment= "Customer Type"/>
<property name= "CustomerName" type= "System.String" comment= "Custom Name"/>
<property name= "Sex" type= "System.Boolean" comment= "gender"/>
<property name= "Region" type= "System.String" comment= "area"/>
<property name= "City" type= "System.String" comment= "urban"/>
<property name= "Idcard" type= "System.String" comment= "identification number"/>
<property name= "Email" type= "System.String" comment= "e-mail"/>
<property name= "Phone" type= "System.String" comment= "Telephone"/>
</Class>
</SmarkDatamodels>
Vssinglefilegenerator generates the following related entities based on XML:
<summary>
User name
</summary>
Public virtual string UserName {
get {
return this.musername;
}
set {
This.musername = value;
This. Entitystate.fieldchange ("UserName");
}
}
<summary>
User password
</summary>
Public virtual string Userpwd {
get {
return this.muserpwd;
}
set {
This.muserpwd = value;
This. Entitystate.fieldchange ("Userpwd");
}
}
<summary>
Customer Type
</summary>
public virtual int CustomerType {
get {
return this.mcustomertype;
}
set {
This.mcustomertype = value;
This. Entitystate.fieldchange ("CustomerType");
}
}

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.