首页 新闻 会员 周边

codesmith没有ouputDirectory属性

0
悬赏园豆:5 [已解决问题] 解决于 2008-07-27 00:35
我使用的codesmith在用nhibernate模板生成实体文件时为啥没有输出路径(ouputDirectory)的属性
zjianjun/Andy的主页 zjianjun/Andy | 初学一级 | 园豆:25
提问于:2008-07-21 14:03
< >
分享
最佳答案
1
<script runat="template"> private string _outputDirectory = String.Empty; [Editor(typeof(System.Windows.Forms.Design.FolderNameEditor), typeof(System.Drawing.Design.UITypeEditor))] [CodeTemplateProperty(CodeTemplatePropertyOption.Optional)] [Category("General")] [Description("结果输出目录。")] [DefaultValue("")] public string OutputDirectory { get { if (_outputDirectory.Length == 0) { return @"D:\"; } else { return _outputDirectory; } } set { if (value.EndsWith("\\")) value = value.Substring(0, value.Length - 1); _outputDirectory = value; } } </script> 放在模板文件中,这是一个用于 CodeSmith 的通用属性,这样就可以在你的模板中使用输出文件夹了,但对于 Hibernate 的模板文件,可能需要你自己修改一下
Dorian Deng | 菜鸟二级 |园豆:280 | 2008-07-21 15:07
清除回答草稿
   您需要登录以后才能回答,未注册用户请先注册