zoukankan      html  css  js  c++  java
  • 动软生成Model(dapper.common)

    <#@ template language="c#" HostSpecific="True" #>
    <#@ output extension= ".cs" #>
    <#
    TableHost host = (TableHost)(Host);
    host.Fieldlist.Sort(CodeCommon.CompareByintOrder);
    #>
    using Dapper.Common;
    using System;
    using System.Collections.Generic;
    using System.Text;
    namespace Review.Model.AccountModel
    {
    <# if( host.TableDescription.Length > 0) {#>
    //<#= host.TableDescription #>
    <# } #>
    [Table("<#= host.GetModelClass(host.TableName) #>")]
    public class <#= host.GetModelClass(host.TableName) #>
    {

    <# foreach (ColumnInfo c in host.Fieldlist)
    { #>/// <summary>
    /// <#= string.IsNullOrEmpty(c.Description) ? c.ColumnName : c.Description #>
    /// </summary>
    <# if (c.IsPrimaryKey)
    {#>
    [Column(name: "<#=c.ColumnName#>", key: ColumnKey.Primary, isIdentity: true, isColumn: true)]
    <#}
    else{
    #>
    [Column(name: "<#=c.ColumnName#>")]
    <#}#>
    public <#= CodeCommon.DbTypeToCS(c.TypeName) #> <#= c.ColumnName #>{ get; set; }

    <# } #>


    }
    }

  • 相关阅读:
    第七章 下
    第七章 上
    第六章 下
    第六章 上
    第五章 下
    linux 系统通过安装包安装mysql 8 步骤(非MariaDB)
    热烈庆祝博客换了新皮肤
    异常处理
    栈计算逆波兰表达式
    栈计算中缀表达式
  • 原文地址:https://www.cnblogs.com/tonglei/p/11245873.html
Copyright © 2011-2022 走看看