这是模板,然后选择对应的表。就可以生成 了

<%-- 
Name: Database Table Properties
Author: Paul Welter
Description: Create a list of properties from a database table
--%>
<%@ CodeTemplate Language="C#" TargetLanguage="C#" Debug="False" Description="Create a list of properties from database table." %>
<%@ Property Name="SourceTable" Type="SchemaExplorer.TableSchema" Category="Context" Description="Table that the object is based on." %>
<%@ Map Name="CSharpAlias" Src="System-CSharpAlias" Description="System to C# Type Map" %>
<%@ Assembly Name="SchemaExplorer" %>
<%@ Import Namespace="SchemaExplorer" %>

[Table("<%=SourceTable.Name%>")]
public class <%= StringUtil.ToPascalCase(SourceTable.Name) %>
{
<% foreach (ColumnSchema column in this.SourceTable.Columns) {  %>
private <%= CSharpAlias[column.SystemType.FullName] %> _<%= StringUtil.ToCamelCase(column.Name) %>;
[Column("<%=column.Name%>")]
public <%= CSharpAlias[column.SystemType.FullName] %> <%= StringUtil.ToPascalCase(column.Name) %>
{
    get { return _<%= StringUtil.ToCamelCase(column.Name) %>; }
    set { _<%= StringUtil.ToCamelCase(column.Name) %> = value; }
}

<% } %>

}

 

相关文章:

  • 2021-10-19
  • 2022-03-04
  • 2021-10-11
  • 2022-02-27
  • 2022-12-23
  • 2021-05-29
  • 2021-06-21
猜你喜欢
  • 2021-10-20
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-11-18
  • 2021-11-28
相关资源
相似解决方案