zoukankan      html  css  js  c++  java
  • 动软生成器针对Mysql数据库生成Model没有注释 EF可以直接使用

    1.修改动软生成器Model模板(简单三层模板)

     1 <#@ template language="c#" HostSpecific="True" #>
     2 <#@ output extension= ".cs" #>
     3 <#
     4     TableHost host = (TableHost)(Host);
     5     host.Fieldlist.Sort(CodeCommon.CompareByintOrder);
     6 #>
     7 using System; 
     8 using System.Text;
     9 using System.Collections.Generic; 
    10 using System.Data;
    11 namespace <#= host.NameSpace #>.Model<# if( host.Folder.Length > 0) {#>.<#= host.Folder #><# } #>
    12 {
    13     <# if( host.TableDescription.Length > 0) {#>
    14      //<#= host.TableDescription #>
    15     <# } #>
    16     public class <#= host.GetModelClass(host.TableName) #>
    17     {
    18                 
    19           <# foreach (ColumnInfo c in host.Fieldlist)
    20         { #>/// <summary>
    21         /// <#= string.IsNullOrEmpty(c.Description) ? c.ColumnName : c.Description #>
    22         /// </summary>
    23         public <#= GetTypeName(c) #> <#= c.ColumnName #>{ get; set; }
    24         <# } #>
    25     }
    26     
    27     
    28 }
    29 
    30 
    31 <#+
    32             private string GetTypeName(ColumnInfo c)
    33             {
    34                 if(c.Nullable && (CodeCommon.DbTypeToCS(c.TypeName).ToString().ToLower())!="string") //如果字段可以为空,并且不是字符串类型 转换为可空类型
    35                 {
    36                    return CodeCommon.DbTypeToCS(c.TypeName)+"?";
    37                 }
    38                 
    39                 else
    40                 {
    41                      return CodeCommon.DbTypeToCS(c.TypeName);
    42                 }
    43                 
    44             }
    45         
    46         #>

    2.替换安装目录下 Maticsoft.DbObjects.dll

    http://pan.baidu.com/s/1gfa9zvt

  • 相关阅读:
    Project项目视图
    Console(控制台视图)
    Layout布局列表
    Layers层列表
    帐户下拉
    TransformGizmo(变换)切换
    Play播放控件
    变换工具
    工具栏
    Help帮助
  • 原文地址:https://www.cnblogs.com/wrhming/p/6084839.html
Copyright © 2011-2022 走看看