View <%-- Name:SQL View Author: XuYabao Description: CREATE View --%> <%@ CodeTemplate Language="C#" TargetLanguage="T-SQL" ResponseEncoding="UTF-8" Description="Generates a update stored procedure." %> <%@ Assembly Name="SchemaExplorer" %> <%@ Import Namespace="SchemaExplorer" %> <%@ Property Name="SourceTable" Type="SchemaExplorer.TableSchema" Category="Context" Description="Table that the stored procedures should be based on." %> <%@ Property Name="Byame" Type="String" Default="a" Category="Context" Description="Author." %> <%@ Property Name="Author" Type="String" Default="徐亚豹" Category="Context" Description="Author." %> <%@ Property Name="Description" Type="String" Default="" Category="Context" Description="Description." Optional="true" %> <mce:script runat="template"><!-- public string GetSqlParameterStatement(ColumnSchema column) { string param = "@" + column.Name + " " + column.NativeType; switch (column.DataType) { case DbType.Int32: break; case DbType.Int64: break; case DbType.Double: break; case DbType.DateTime: break; case DbType.Decimal: { param += "(" + column.Precision + ", " + column.Scale + ")"; break; } default: { if (column.Size > 0) { param += "(" + column.Size + ")"; } break; } } return param; } // --></mce:script> ----------------------------------------------------------------- -- 描述: <% if (SourceTable.Description.Trim().Length == 0) { %><%= SourceTable.Name.Substring(2) %><% }else{%><%= SourceTable.Description %><% } %><%= Description %> -- 创建: <%= Author %> <%= DateTime.Now.ToString("yyyy-MM-dd") %> ----------------------------------------------------------------- CREATE VIEW v_<%= SourceTable.Name.Substring(2) %> AS SELECT <% for (int i = 0; i < SourceTable.Columns.Count; i++) { %> <%= Byame %>.<%= SourceTable.Columns[i].Name %><% if (i < SourceTable.Columns.Count - 1) { %>,<% } %> --<%= SourceTable.Columns[i].Description%> <% } %> FROM <%= SourceTable.Name %> <%= Byame %> <% for (int i = 0; i < SourceTable.Columns.Count; i++) { %> <% if( SourceTable.Columns[i].Name == "f_RowFlag" ){ %> WHERE <%= Byame %>.f_RowFlag & 4 = 0 <% }} %>