CodeSmith-Select
<%@ CodeTemplate Language="C#" TargetLanguage="Text" Debug="False" Description="Template description here." %> <%@ Property Name="SourceTable" Type="SchemaExplorer.TableSchema" Category="数据库表" Optional="True" Description="the table name" %> <%@ Assembly Name="SchemaExplorer" %> <%@ Import Namespace="SchemaExplorer" %> <% string cols=string.Empty; foreach(ColumnSchema col in this.SourceTable.Columns) { cols+=col.Name+","; } cols=cols.Remove(cols.Length-1); string[] strParamNames=cols.Split(','); %> select <%=cols %> from <%=this.SourceTable.Name %>