首页 新闻 会员 周边 捐助

codesmith 读取oracle数据库 表中的Description为什么读取不到?

0
[待解决问题]

sqlserver我试过是可以的!不知道oracle为什么读取不到啊!

<%--
Name: CodeSmith Model
Author:   2009-08-30  QQ:418715961 E_MAIL:chhuic@163.com 
Description: CodeSmith Model
--%>
<%@ CodeTemplate Language="C#" TargetLanguage="C#"
      Description="Generates a class including a special informational header" %>
 
<%@ Property Name="NameSpace" Type="String"
      Category="Context"
      Description="The namespace to use for this class" %>
 
<%@ Property Name="ClassName" Type="String"
      Category="Context"
      Description="The name of the class to generate" %>
 
<%@ Property Name="SourceTable" Type="SchemaExplorer.TableSchema" Category="Context"  Description="Table that the stored procedures should be based on." %>

<%@ Assembly Name="SchemaExplorer" %>
<%@ Import Namespace="SchemaExplorer" %>
<script runat="template">
public string CSharpType(ColumnSchema column)
{
 if (column.Name.EndsWith("TypeCode")) return column.Name;

 switch (column.DataType)
 {
  case DbType.AnsiString: return "string  ";
  case DbType.AnsiStringFixedLength: return "string  ";
  case DbType.Binary: return "byte[]  ";
  case DbType.Boolean: return "bool    ";
  case DbType.Byte: return "byte    ";
  case DbType.Currency: return "decimal ";
  case DbType.Date: return "DateTime";
  case DbType.DateTime: return "DateTime";
  case DbType.Decimal: return "decimal ";
  case DbType.Double: return "double  ";
  case DbType.Guid: return "Guid    ";
  case DbType.Int16: return "short   ";
  case DbType.Int32: return "int     ";
  case DbType.Int64: return "long   ";
  case DbType.Object: return "object   ";
  case DbType.SByte: return "sbyte   ";
  case DbType.Single: return "float   ";
  case DbType.String: return "string  ";
  case DbType.StringFixedLength: return "string  ";
  case DbType.Time: return "TimeSpan";
  case DbType.UInt16: return "ushort  ";
  case DbType.UInt32: return "uint    ";
  case DbType.UInt64: return "ulong   ";
  case DbType.VarNumeric: return "decimal ";
  default:
  {
   return "__UNKNOWN__" + column.NativeType;
  }
 }
}
</script>

///////////////////////////////////////////////////////////////////////////////////////
// File: <%=SourceTable.Name %>Model.cs
// Description: the <%=SourceTable.Name %>Model Created By CodeSmith.
// ---------------------
// Copyright: @ <%= DateTime.Now.Year %>
// ---------------------
// History:
///////////////////////////////////////////////////////////////////////////////////////
 
using System;
 
namespace <%=NameSpace%>.<%=ClassName%>
{
   /// <summary>
   /// Summary description for <%=SourceTable.Name %>Model.
   /// Description:<%=SourceTable.Description %>
   /// </summary>
   public class <%=SourceTable.Name %>Model
   {
  #region Private Protery
 
  <%for(int i=0;i<SourceTable.Columns.Count;i++){%>
  private <%=CSharpType(SourceTable.Columns[i])%> _<%=SourceTable.Columns[i].Name.Substring(0,1).ToLower()+SourceTable.Columns[i].Name.Substring(1,SourceTable.Columns[i].Name.Length-1)%>;
  <%}%>
 
  #endregion
 
  #region Constructor
  /// <summary>
  /// <%=SourceTable.Name %>Struct Constructor
  /// </summary>
        public <%=SourceTable.Name %>Model()
        {
        }
  /// <summary>
  /// <%=SourceTable.Name %>Struct Constructor(Have Parameters)
  /// </summary>
  <%for(int i=0;i<SourceTable.Columns.Count;i++){%>
  ///<param name="<%=SourceTable.Columns[i].Name.Substring(0,1).ToLower()+SourceTable.Columns[i].Name.Substring(1,SourceTable.Columns[i].Name.Length-1)%>"><%if(SourceTable.Columns[i].Description.Length>0){%><%=SourceTable.Columns[i].Name+"  "+SourceTable.Columns[i].Description%><%}else{%><%=SourceTable.Columns[i].Name%><%}%></param>
  <%}%>
  public <%=SourceTable.Name %>Model(<%for(int i=0;i<SourceTable.Columns.Count;i++){%><%=CSharpType(SourceTable.Columns[i])%> <%=SourceTable.Columns[i].Name.Substring(0,1).ToLower()+SourceTable.Columns[i].Name.Substring(1,SourceTable.Columns[i].Name.Length-1)%><% if (i < SourceTable.Columns.Count - 1) { %>,<%}%><%}%>)
  {
  <%for(int i=0;i<SourceTable.Columns.Count;i++){%>
   this._<%=SourceTable.Columns[i].Name.Substring(0,1).ToLower()+SourceTable.Columns[i].Name.Substring(1,SourceTable.Columns[i].Name.Length-1)%> = <%=SourceTable.Columns[i].Name.Substring(0,1).ToLower()+SourceTable.Columns[i].Name.Substring(1,SourceTable.Columns[i].Name.Length-1)%>;
  <%}%>
  }
  #endregion
   
  #region public Property
          <%for(int i=0;i<SourceTable.Columns.Count;i++){%>
 
  ///<Summary>
  /// <%=SourceTable.Columns[i].Name%><%if(SourceTable.Columns[i].Description.Length>0){%>
  /// <%=SourceTable.Columns[i].Description%><%}%>
  ///</Summary>
  public <%=CSharpType(SourceTable.Columns[i]).Trim()%> <%=SourceTable.Columns[i].Name%>
  {
   get { return _<%=SourceTable.Columns[i].Name.Substring(0,1).ToLower()+SourceTable.Columns[i].Name.Substring(1,SourceTable.Columns[i].Name.Length-1)%>; }
   set {  _<%=SourceTable.Columns[i].Name.Substring(0,1).ToLower()+SourceTable.Columns[i].Name.Substring(1,SourceTable.Columns[i].Name.Length-1)%> = value; }
  }


  <%}%>
 
  #endregion 
   }
}

awp110的主页 awp110 | 初学一级 | 园豆:12
提问于:2011-12-19 17:07
< >
分享
所有回答(2)
0

遇到和你一样的问题  

zhangzhigang | 园豆:110 (初学一级) | 2012-03-14 08:55
0

我是在oracle中读的到,在sqlserver中读不到

冠吸柏汁霆疯 | 园豆:202 (菜鸟二级) | 2013-09-22 11:58
清除回答草稿
   您需要登录以后才能回答,未注册用户请先注册