• 动软软件 生成 实体类模板(EnterpriseFrameWork框架)


    1.废话不多说,直接上效果图 。

    2 .动软模板代码

    <#@ template language="c#" HostSpecific="True" #>
    <#@ output extension= ".cs" #>
    <#
        TableHost host = (TableHost)(Host);
        host.Fieldlist.Sort(CodeCommon.CompareByintOrder);
    #>
    using System;
    using System.Collections.Generic;
    using System.Linq;
    using System.Text;
    using EFWCoreLib.CoreFrame.Orm;
    using EFWCoreLib.CoreFrame.Business;
    namespace Cloud.Code.Entity<# if( host.Folder.Length > 0) {#>.<#= host.Folder #><# } #>
    {
        <# if( host.TableDescription.Length > 0) {#>
         //<#= host.TableDescription #>
        <# } #>
      [Serializable]
       [Table(TableName = "<#= host.GetModelClass(host.TableName) #>", EntityType = EntityType.Table, IsGB = true)]
     
       public class <#= host.GetModelClass(host.TableName) #> :AbstractEntity
        {  
            #region 自動生成
              <# foreach (ColumnInfo c in host.Fieldlist)
            { #>
            /// <summary>
            /// <#= string.IsNullOrEmpty(c.Description) ? c.ColumnName : c.Description #>
            /// </summary>      
            <# if(c.IsIdentity) {#>
               [Column(FieldName = "<#= c.ColumnName #>", DataKey = false,  Match = "", IsInsert = fasle)]
             <# } else {#>        
               [Column(FieldName = "<#= c.ColumnName #>", DataKey = false,  Match = "", IsInsert = true)]
              <# } #>
            public <#= CodeCommon.DbTypeToCS(c.TypeName) #> <#= c.ColumnName #> { get; set ;}  
            <# } #>
          #endregion
       
        }
    }
    实体类

    3.为什么推荐此 ORM 实体类。因为在 实际的 工作中,参与过一项过万级的项目,当时是配有专门的DB人员。其中数据库表 及 表的字段 含有 中文,当初百思不得其解,最后得到的回复是 老板要求,o(╯□╰)o

  • 相关阅读:
    analysis of algorithms
    Measurement of Reflected Radiation
    lecture 5
    lecture 3
    字符串
    Emission of Radiation辐射发射
    Electromagnetic Radiation(EMR) 电磁辐射
    Linux FTP服务器-VSFTPD虚拟用户配置
    jenkins notes
    python nose使用记录
  • 原文地址:https://www.cnblogs.com/chuangjie1988/p/6929783.html
Copyright © 2020-2023  润新知