一:简介
NetTiers是CodeSmith中的一个模板实例,运行CodeSmith,在下面的路径下可找到NetTiers.cst模板
CodeSmith Generator Studio——>Template Exlorer——》CodeSmith Generator 7.0 Samples——>Frameworks——>NetTiers——>NetTiers.cst
官方网站 http://nettiers.net/Home.ashx
NetTiers系列知识:http://www.cnblogs.com/iCaca/category/80950.html
二:NetTier模板参数解释
01.Getting Started – Required(必填项) | |||
ChooseSourceDatabase | 选择数据库 | ||
MappingFile | Mapping文件位置(会根据output目录自动更改) | ||
OutputDirectory | 文件输出目录 | ||
RootNameSpace | 根节点的命名空间 | ||
01b.Filter by Individual Objects – Optional(可选项) | |||
EnumTables | 选择枚举表,表中的所有数据都会被用作枚举类型,要求:第一列为主键,第二列为唯一键,第三列为描述,必须添加到SourceTables | ||
SourceTables | 选择需要生成的表 | ||
SourceViews | 选择需要生成的视图 | ||
02.Framework Generation – Optional(可选项) | |||
AutoIncrementBuildVersion | 自动包含编译的版本 | ||
CustomCodeFolderName | 自定义代码文件夹名称 | ||
DotNetVersion | DotNet版本(.net版本) | ||
EntLibVersion | 微软企业库的版本 | ||
EqualitySemantics |
| ||
ExecuteSql | 生成后自动执行SQL | ||
IncludeComponentLayer | 生成组件层 | ||
IncludeDatabaseFeatures | 是否包含数据库特性(sql2005特有) | ||
IncludeGenerateddate | 包含生成的日期(会在生成的文件中包含生成文件时的日期) | ||
IncludeUnitTest | 包含单元测试(可以选微软的VSTS或NUnit) | ||
IncludeWCFDataAttributes | 包含WCF属性(需要.net3.0) | ||
IncludeXmlAttributes | 包含XML属性 | ||
IsConnectionStringAzure |
| ||
LaunchVisualStudio | 生成结束后是否运行解决方案 | ||
NameConversion | 名称转换 | ||
SerializeEntityState | 序列化实体类,在使用WebServices时非常有用 | ||
SQLFolderName | SQL脚本输出的目录 | ||
TimeStandard | 标准时间 | ||
ValidationType | 验证类型 | ||
ViewReport | 生成完成后显示报表 | ||
VisualStudioVersion | VisualStudio版本 | ||
03.Namespaces – Required(必填项) | |||
BusinessLogicLayerNameSpace | 业务逻辑层命名空间 | ||
ComponentLayerNameSpace | 组件层命名空间 | ||
DataAccessLayerNameSpace | 数据访问层的命名空间 | ||
UnitTestsNameSpace | 单元测试命名空间 | ||
04.General – Advanced(高级选项) | |||
CompanyName | 公司名称,会被包含在AssemblyInfo.cs中 | ||
CompanyURL | 公司网址 | ||
SignAssembly | SNK公钥 | ||
05.WebLibrary – Advanced(高级选项) | |||
DataSourceEnableTransactionDefault | 允许用户默认数据源。 | ||
GenerateWebLibrary | 生成webLibrary控件 | ||
IncludeDesignTimeSupport | 包含设计时支持 | ||
06.Web- Advanced(高级选项) | |||
AttemptCreateLocalVirtualDirectory | 为webservice创建虚拟目录 | ||
GenerateWebservice | 是否形成webservice服务 | ||
WebServiceClassName | 填写webservice的类名 | ||
WebServiceOutputPath | webservice的本地路径 | ||
WebServiceUrl | webservice的URL | ||
06b.Website- Advanced(高级选项) | |||
DateFormat | 日期格式 | ||
GenerateWebsite | 创建web站点 | ||
GenerateWebsiteAdmin | 创建web站点管理员 | ||
IncludeAtlasLibrary | 包含微软的Ajax库 | ||
IncludeAtlasToolkit | 包含Ajax扩展工具 | ||
OverwriteWebConfig | 覆盖web.config文件 | ||
UseWebAppProject | 使用web项目,需要安装AppProject补丁, 中文版不支持 | ||
WebAdminSiteName | 管理员站点名称 | ||
07.CRUD – Advanced(高级选项) | |||
AllowCustomProcMultipleResults |
| ||
| 自定义存储过程为nullable类型使用默认值 | ||
CustomNonMatchingReturnType | DataSet or IDataReader | ||
CustomProcedureStartsWith | 自定义存储过程的前缀 | ||
DropStyle | 选择Entity的话生成后Drop删除已经生成的存储过程;选择All的话,会删除满足存储过程前缀,不满足自定义存储过程前缀的存储过程 | ||
IncludeCustoms | 生成自定义存储过程 | ||
IncludeDelete | 生成delete存储过程 | ||
IncludeDrop | 是否生成drop语句,如果是则根据DropStyle生成 | ||
IncludeFind | 生成Find存储过程 | ||
IncludeGet | 生成get存储过程 | ||
IncludeGetList | 生成GetList存储过程 | ||
IncludeGetLisByFK | 生成根据外键查询的存储过程 | ||
InclludeGetListByIX | 生成根据唯一键查询的存储过程 | ||
IncludeInsert | 生成Insert存储过程 | ||
IncludeManyToMany | 生成多对多关系 | ||
IncludeRelations | 生成关联 | ||
IncludeSave | 生成保存 | ||
IncludeUpade | 生成更新 | ||
IsolationLevel | 事务隔离级别 | ||
LibraryPath | References | ||
ParseDbColDefaultVal | 使用数据库字段默认值初始化实体属性 | ||
RetryEnabled | 允许重试,当执行出错时允许重试 | ||
RetryMaxAttempts | 重试次数 | ||
RetrySleepStyle | 重试等待类型 | ||
RetrySleepTime | 重试间隔时间 | ||
UseTimestampConcurrency | 使用时间戳检查 | ||
08.Storedprocedures – Advanced(高级选项) | |||
DeleteSuffix | 存储过程 delete 语句的前缀 | ||
FindSuffix | 存储过程 find 语句的前缀 | ||
GrantReadUser | 存储过程 grant 语句的前缀,允许应用于只读存取过程 | ||
GrantUser | 存储过程 grant 语句的前缀 | ||
InsertSuffix | 存储过程 insert 语句的前缀 | ||
ProcedurePrefix | 存储过程的前缀 | ||
SelectAllSuffix | 存储过程 select all 语句的前缀 | ||
SelectSuffix | 存储过程 select 语句的前缀 | ||
UpdateSuffix | 存储过程 update 语句的前缀 | ||
09.Code style – Advanced(高级选项) | |||
AliasFilePath | 别名路径 | ||
BaseClassFormat | 基类 {0}Base | ||
ChangeUnderscoreToPascalCase | 将 _ 转换为 Pascal | ||
CollectionFormat | 子集 {0}Collection 一对多时,会包含子表(数据)的集合 | ||
ColumnClassNameFormat | {0}Collumn列类名格式 | ||
ComparerClassNameFormat | {0}Comparer | ||
EntityFormat | 实体格式默认{0} | ||
EntityKeyFormat | EntityKey格式{0}Key | ||
EnumFormat | 枚举格式{0}List | ||
EventArgsClassNameFormat | {0}EventArgs | ||
EventHandlerClassNameFormat | {0}EventHandler | ||
GenericListFormat | Nettiers自带的泛型集合之一 TList<{0}> 表使用 | ||
GenericViewFormat | 泛型集合之一 VList<{0}> 视图使用 | ||
InterfaceFormat | 接口格式I{0} | ||
ManyToMayFormat | 多对多格式{0}From{1} | ||
MethodNames | 方法名称 | ||
BulkInsert | 批量插入方法的名称 | ||
Deepload | 主从表查询方法的名称 | ||
DeepSave | 主从表保存方法的名称 | ||
Delete | 删除方法的名称 | ||
Find | 查询方法的名称 | ||
Get | Get方法的名称 | ||
GetAll | 查询全部方法的名称 | ||
GetPaged | 分页查询方法的名称 | ||
GetTotalItems | 查询行数方法的名称 | ||
Insert | 插入方法的名称 | ||
Save | 保存方法的名称 | ||
Update | 更新方法的名称 | ||
ProviderFormat | 提供者命名格式 | ||
SafeNamePrefix | 纠正在GetVariableName EntityViewBase方法的调用使用GetFieldName而不是利用重构的命名方法。 | ||
ServiceClassNameFormat | Service类名称前缀 | ||
StrippedTablePrefixed | 忽略前缀,填写的前缀讲不会被生成到实体中 入如tbl,tbl_ | ||
StrippedTableSuffixes | 忽略后缀 | ||
UserPascalCasing | 使用PascalCasing | ||
09.Winforms Library – Advanced(高级选项) | |||
GenerateWinLibrary | 生成winform的控件库 | ||
10.WebLibrary.Security – Optional(安全选项) | |||
EntityMembershipUserPKCol |
| ||
GenerateWebSecurity |
| ||
MembershipUserMapFile |
| ||
UserMD5Hash | 使用MD5Hash加密 |