CodeSmith的使用

1.如果要调用数据库中的表,请引用CodeSmith的SchemaExplorer
<%@ Assembly Name="SchemaExplorer" %>
<%@ Import Namespace="SchemaExplorer" %>
<%@ Property Name="SourceTable" Type="SchemaExplorer.TableSchema" Category="Context"  Description="Table that the stored procedures should be based on." %>
如果想访问视图的话,则将变量类型Type中的SchemaExplorer.TableSchema修改为SchemaExplorer.ViewSchema即可。
2.使用SourceTable.NonPrimaryKeyColumns即可得到非主键字段的集合,然后再使用SourceTable.PrimaryKey.MemberColumns得到数据表中的主键集合.
原文地址:https://www.cnblogs.com/gghxh/p/637966.html