• DbEntry.Net3.6 Model from a database table CodeSimth 模板


    <%-- 
    Name: DbEntry.Net3.
    6
    Author: shiningrise@gmail.com
    Description: Create DbEntry.Net3.
    6 Model 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" %>

    using System;
    using System.Collections.Generic;
    using System.Linq;
    using System.Text;
    using Lephone.Data.Definition;
    using Lephone.Linq;

    namespace Wz16.Models   //Chang it to you namespace string
    {
        
    /// <summary>
        
    /// <%= this.SourceTable.Description %>
        
    /// </summary>
        [DbTable("<%= this.SourceTable.Name %>")]
        
    public abstract class <%= StringUtil.ToPascalCase(this.SourceTable.Name) %> : LinqObjectModel< <%= StringUtil.ToPascalCase(this.SourceTable.Name) %>>
        {
    <% foreach (ColumnSchema column in this.SourceTable.Columns) {  %>
        
    <% if( StringUtil.ToPascalCase(column.Name) != "Id" ) {%>
            
    /// <summary>
            
    /// <%= column.Description %>
            
    /// </summary>
            <%if( CSharpAlias[column.SystemType.FullName] == "string" )  {%>
            [Length(
    <%= column.Size %>)] <% if( column.AllowDBNull ) { %>[AllowNull] <% } %>public abstract <%= CSharpAlias[column.SystemType.FullName] %> <%= StringUtil.ToPascalCase(column.Name) %> { getset; }
            
            
    <% } else { %>
            
    public abstract <%= CSharpAlias[column.SystemType.FullName] %> <% if( column.AllowDBNull ) { %>? <% } %><%= StringUtil.ToPascalCase(column.Name) %> { getset; }    
            
    <% } %>
            
        
    <% } %>
    <% } %>
        }
    }
  • 相关阅读:
    Python在计算内存时应该注意的问题?
    如何高效地远程部署?自动化运维利器 Fabric 教程
    强大的 Python 任务自动化工具!invoke 十分钟入门指南
    进一步学习 nox 教程,轻松掌握命令行用法
    Oracle Solaris 11.4安装桌面/gdb
    Solaris 10上Oracle 10g安装步骤图解
    Oracle Solaris 10图文安装
    读取模式下cbc latch的事件模拟(热块竞争和热链竞争)-P62
    关于位图数据位和系统管理区大小-P6
    关于位图数据和标记位-P3
  • 原文地址:https://www.cnblogs.com/shiningrise/p/1617529.html
Copyright © 2020-2023  润新知