首先到网上下载codesmith工具(必须是破解版)
然后在CodeSmithStudio新建一个Csharp的Template
最后拷贝代码:
<%@ CodeTemplate Language="C#" TargetLanguage="C#" Description="Template description here." %>
<%@ Assembly Name="SchemaExplorer" %>
<%@ Import Namespace="SchemaExplorer" %>
<%@ Property Name="SourceTable" Type="SchemaExplorer.TableSchema" Category="Context" %>
<%@ Property Name="NameSpace" Type="String" Category="参数" Description="命名空间" Default="" Optional="True"%>
<%@ Import Namespace="System.Text.RegularExpressions" %>
using System;
using System.Collections.Generic;
using System.Text;
namespace <%=NameSpace%>
{
[Serializable]
public class <%=GetClassName(SourceTable)+&