<#@ template debug="true" hostspecific="true" language="C#" #> <#@ assembly name="System.Core" #> <#@ assembly name="System.Data" #> <#@ assembly name="System.Xml" #> <#@ assembly name="System.Configuration" #> <#@ import namespace="System.Linq" #> <#@ import namespace="System.Text" #> <#@ import namespace="System.Collections.Generic" #> <#@ import namespace="System.Data.SqlClient" #> <#@ import namespace="System.Data" #> <#@ output extension=".cs" #> using System;

namespace EIR.Module { <#     //System.Diagnostics.Debugger.Launch();//---进入调试     string nameClass= System.IO.Path.GetFileNameWithoutExtension(this.Host.TemplateFile);     string configPath=Host.ResolveAssemblyReference("$(ProjectDir)")+"app.config";     var configPathMap=new System.Configuration.ExeConfigurationFileMap(){ExeConfigFilename=configPath};     var appConfig=System.Configuration.ConfigurationManager.OpenMappedExeConfiguration(configPathMap, System.Configuration.ConfigurationUserLevel.None);     var connSection= appConfig.GetSection("connectionStrings") as System.Configuration.ConnectionStringsSection;      string cnnstr= connSection.ConnectionStrings["cnnstrMasterMssql"].ConnectionString;     string cmdstrForColDescription=string.Format("with htt as({0}),gmm as ({1}) select htt.name,gmm.value from htt left join gmm on htt.column_id=gmm.minor_id",                              "select * from sys.columns where object_id=OBJECT_ID('"+nameClass+"')",                              "select * from sys.extended_properties where sys.extended_properties.major_id=OBJECT_ID('"+nameClass+"')");     this.WriteLine(string.Format("{1}public class {0}",nameClass,new String(' ',4)));     this.WriteLine(new String(' ',4)+"{");     using (SqlConnection cnn = new SqlConnection(cnnstr))             {                 using (SqlCommand cmd = cnn.CreateCommand())                 {                     cnn.Open();                     cmd.CommandText = "select * from "+nameClass;                     SqlDataReader rr=cmd.ExecuteReader();                     DataTable table = rr.GetSchemaTable();                     rr.Close();                     cmd.CommandText=cmdstrForColDescription;                     using(SqlDataAdapter adapater=new SqlDataAdapter(cmd))                     {                         DataTable tableDesp=new DataTable();                         adapater.Fill(tableDesp);                         foreach (DataRow row in table.Rows)                         {                             string colName = row["ColumnName"].ToString();                             string colType = row["DataType"].ToString().Substring(7);        bool allowDBNull=Convert.ToBoolean(row["AllowDBNull"]);                             if(allowDBNull && !colType.Equals("String"))                                     colType="Nullable<"+colType+">";                             this.WriteLine(string.Format("{3}/// <summary>",colType,colName,"{set;get;}",new String(' ',8)));                             this.WriteLine(string.Format("{3}///{4}",colType,colName,"{set;get;}",new String(' ',8),tableDesp.Select("name='"+colName+"'")[0]["value"].ToString().Replace("\r\n"," ").Replace("\n"," ").Replace("\n"," ")));                             this.WriteLine(string.Format("{3}/// </summary>",colType,colName,"{set;get;}",new String(' ',8)));                             this.WriteLine(string.Format("{3}public {0} {1} {2}",colType,colName,"{set;get;}",new String(' ',8)));                         }                     }                 }             }  #>     } }

sql的列的说明的更多相关文章

  1. SQL Server 列存储索引强化

    SQL Server 列存储索引强化 SQL Server 列存储索引强化 1. 概述 2.背景 2.1 索引存储 2.2 缓存和I/O 2.3 Batch处理方式 3 聚集索引 3.1 提高索引创建 ...

  2. SQL 计算列

    SQL计算列,可以解决一般标量计算(数学计算,如ColumnA*ColumnB)的问题,而子查询计算(如select sum(salary) from tableOther where id=’ABC ...

  3. SQL 一列数据整合为一条数据

    SQL 一列数据整合为一条数据: SELECT  STUFF(( SELECT distinct  ',' + 列名 FROM 表名 where  [条件] FOR XML PATH('') ), 1 ...

  4. jmeter奇淫妙计之遍历sql多列结果集

    foreach控制器加${__V()}函数和${__counter(TRUE,)}函数 处理sql多列结果的遍历真的是绝配啊,之前一直用循环控制器+count函数,或者while控制器加count函数 ...

  5. Sql 标识列 增长1000

    Sql 标识列 增长1000 的解决办法: 1. Open "SQL Server Configuration Manager" 2. Click "SQL Server ...

  6. MS SQL 标识列的查询

    摘自: http://www.2cto.com/database/201212/175000.html   SQL标识列的查询   1.判段一个表是否具有标识列    www.2cto.com   可 ...

  7. SQL 序号列ROW_NUMBER,RANK,DENSE_RANK、NTILE

    原文:SQL 序号列ROW_NUMBER,RANK,DENSE_RANK.NTILE SQL 2005新增加相关函数 : ROW_NUMBER,RANK,DENSE_RANK.NTILE 窗口函数 O ...

  8. 使用Spark加载数据到SQL Server列存储表

    原文地址https://devblogs.microsoft.com/azure-sql/partitioning-on-spark-fast-loading-clustered-columnstor ...

  9. SQL Server 列存储性能调优(翻译)

    原文地址:http://social.technet.microsoft.com/wiki/contents/articles/4995.sql-server-columnstore-performa ...

  10. SQL动态列查询

    数据库中为了实现表格数据的自由设置,我们经常设计纵表,或者列定义的表(如下KeyValue),定义一个列超级多的表中每个字段的意义. 但是在设计时简单的东西却很容易被人们忘记,如下一个简单但是很松散的 ...

随机推荐

  1. pc端页面在移动端显示问题

    1.pc端页面在移动端显示,默认视口宽度是980px(也就是body宽度是980px),可通过meta标签设置为需要的尺寸,比如页面中元素最大宽度是1220px,则如下所示 <meta name ...

  2. 今天初步了解了informix的锁的概念

     今天初步了解了informix的锁的概念  2005-06-12 01:07:05 分类: IT生活 在load的时候,碰到好几次"-134 ISAM Error :no more loc ...

  3. python虚拟环境

    sudo apt-get install python-virtualenv virtualenv --no-site-packages files cd files source ./bin/act ...

  4. SPSS数据分析—配对Logistic回归模型

    Lofistic回归模型也可以用于配对资料,但是其分析方法和操作方法均与之前介绍的不同,具体表现 在以下几个方面1.每个配对组共有同一个回归参数,也就是说协变量在不同配对组中的作用相同2.常数项随着配 ...

  5. js页面跳转(含框架跳转)整理

    js方式的页面跳转1.window.location.href方式    <script language="javascript" type="text/java ...

  6. JavaScript实现快速排序

    思想: 通过分治思想.递归方法将数据依次分解为包含较小元素和较大元素的不同子序列 1.在数组中选择一个元素为基准 2.对数组进行遍历,小于基准的元素都移到基准的左边,大于基准的元素都移到基准的右边 3 ...

  7. ios第二天{函数}

    ////  main.m//  DAY3-1.6作业:工程敲4遍/*  作业:限时代码3分钟     提示用户从键盘输入一个整数(100以内) .如果输入的数,不是7的倍数,且不含7(个位和十位都不含 ...

  8. SQL数据库索引查询

    SELECT IA_ID,IA_Title,IT_ParentID,IA_Content,IA_CreateDate,IA_Author, )))) AS States FROM dbo.InfoAr ...

  9. 会计凭证BAPI_ACC_DOCUMENT_POST

    *&---------------------------------------------------------------------* *& Report ZFIFB107 ...

  10. WinForm 菜单和工具栏

    菜单和工具栏: 1.MenuStrip:顶部菜单 优先级最高,默认在最顶部 (1)分割线:a.打一个减号 “-”                   b.右键插入Separator (2)点击事件:每 ...