• ----:)欢迎访问源码网(:----
    • 首页
    • 博客
    • 学院
    • 下载
    • 论坛
    • 影视
    • 发布源码
    • RSS
    • ITPig
    • 笑话网
    • 百家姓
    • 繁體中文

源码网 - 中国第一源码门户
选择镜像:网通镜像 - 电信主站
  • 首 页
  • 新闻动态
  • 网站运营
  • 网页制作
  • WEB开发
  • 编程开发
  • 图像媒体
  • 操作系统
  • 数据库
  • 服务器
热门搜索 优化 SEO 故事 cms IIS7 MySQL 个人 AdSense 主题推广 | 文章搜索: 高级搜索
会员登录/控制面版您的位置: 学院首页 >> WEB开发 >> .NET 开发 >> 详细内容
 

推荐文章

 
 

热点文章

  • FckEditor远程图片下载插件
  • TFS(Team Foundation Server)使用经验
  • IIS过滤器实现.NET程序不破解DLL替换字符串一法
  • 为ASP.NET封装的SQL数据库访问类
  • ASP.NET2.0中文验证码的实现
  • Url地址重写,利用HttpHander手工编译页面并按需生成静..
  • ASP.NET学习笔记一——ASP和ASP.NET比较
  • 使用HtmlInputHidden 控件在本页面保持状态和跨页面传..
  • ASP.Net发邮件
  • Silverlight 2.0中文学习资源集萃
  • WinForm中使用XtraGrid控件,实现在界面中动态修改列显..
  • 解析ASP.NET木马文件操作
 
 

相关文章

 
 

百度搜索

 
 

用CodeSmith生成数据库字典

  • 阅览次数:
  • 文章来源:
  • 原文作者:
  • 整理日期: 2008-07-11
  • 发表评论
  • 字体大小:
  • 小
  • 中
  • 大

<%@ CodeTemplate Language="C#" TargetLanguage="text" ResponseEncoding="UTF-8" Description="Generates a update stored procedure." %>
<%@ Property Name="SourceDatabase" Type="SchemaExplorer.DatabaseSchema" Category="Context" Description="Database that the documentation should be based on." %>
<%@ Property Name="Author" Type="System.String" Default="Pantao" Optional="False" Category="Description" Description="About Author" %>
<%@ Assembly Name="SchemaExplorer" %>
<%@ Import Namespace="SchemaExplorer" %>
<script runat="template">
public string GetSqlParameterStatement(ColumnSchema column)
{
      string param = "";
 
      switch (column.DataType)
      {
            case DbType.Decimal:
            {
                  param += "(" + column.Precision + ", " + column.Scale + ")";
                  break;
            }
   case DbType.Boolean:
   case DbType.Int32:
   case DbType.DateTime:
   case DbType.Double:
   case DbType.Single:
   case DbType.Byte:
   case DbType.Int64:
   case DbType.Int16:
   
   break;
            default:
            {
                  if (column.Size > 0)
                  {
                        param += "(" + column.Size + ")";
                  }
                  break;
            }
      }
 
      return param;
}
</script>
<% TableSchemaCollection tables = new TableSchemaCollection(SourceDatabase.Tables); %>
数据库字典(总表数:<% =tables.Count.ToString() %>)
作者:<% =Author %> 时间:<% =DateTime.Now.ToShortDateString() + " " + DateTime.Now.ToShortTimeString() %>
<% for(int i=0; i<tables.Count; i++) { %>

<% =i + 1 + "." %>表名:【<% =tables[i].Name %>】
 <% for(int k=0; k<tables[i].Columns.Count; k++) { %>
 <% =tables[i].Columns[k].Name %>  <% if (tables[i].Columns[k].IsPrimaryKeyMember) {%>Primary<% } %> <% =tables[i].Columns[k].NativeType + GetSqlParameterStatement(tables[i].Columns[k]) %> <% if(tables[i].Columns[k].AllowDBNull) { %>AllowNull<% } %>
 <% ="〖描述:〗" + tables[i].Columns[k].Description %>
 <% } %>
<% } %>

上一篇:PHP使用zlib扩展实现页面GZIP压缩输出
下一篇:构建支持Master/Slave读写分离的数据库操作类
  • 网友评论:
  • 查看所有评论
  • 我要发表评论
您的网名:
留言主题:
你要发表的内容:

 

关于本站 | 广告联系 | 版权声明 | 网站地图 | 发布软件 | 帮助中心 | 源码论坛

Copyright © 2005-2007 CodePub.Com  程序支持:木翼  滇ICP备05005971号