c#中xml文檔正文編譯dll援用到其它項目示例。本站提示廣大學習愛好者:(c#中xml文檔正文編譯dll援用到其它項目示例)文章只能為提供參考,不一定能成為您想要的結果。以下是c#中xml文檔正文編譯dll援用到其它項目示例正文
<#@ template debug="True" hostspecific="True" language="C#" #><#@ assembly name="System.Core" #>
<#@ assembly name="System.Data" #>
<#@ assembly name="System.xml" #>
<#@ import namespace="System.Collections.Generic" #>
<#@ import namespace="System.Data" #>
<#@ import namespace="System.Data.SqlClient" #>
<#@ import namespace="System.Linq" #>
<#@ import namespace="System.Text" #>
<#@ import namespace="System.Collections.Generic" #>
<#@ output extension=".cs" #>
using System;
using DotNet.Framework.DataAccess.Attribute;
using System.Data;
namespace MyProject.Entities
{
<#
string connectionString = "Data Source=localhost;Initial Catalog=EDNFramework;User ID=sa;pwd=as";
SqlConnection conn = new SqlConnection(connectionString);
conn.Open();
System.Data.DataTable schema = conn.GetSchema("TABLES");
string selectQuery = "select * from @tableName";
SqlCommand command = new SqlCommand(selectQuery,conn);
SqlDataAdapter ad = new SqlDataAdapter(command);
System.Data.DataSet ds = new DataSet();
foreach(System.Data.DataRow row in schema.Rows)
{
#>
public class <#= row["TABLE_NAME"].ToString()#>
{<#
ds.Tables.Clear();
command.CommandText = selectQuery.WordStr("@tableName",row["TABLE_NAME"].ToString());
ad.FillSchema(ds, SchemaType.Mapped, row["TABLE_NAME"].ToString());
foreach (DataColumn dc in ds.Tables[0].Columns)
{#>
[DataMapping("<#= dc.ColumnName #>")]
public <#= dc.DataType.Name #> <#= dc.ColumnName #> { get; set; }
<#}#>
}
<#}#>
}