首页 > 数据库 > Oracle > 正文

在codesmith中去掉oracle下划线

2024-08-29 13:34:12
字体:
来源:转载
供稿:网友
    CodeSmith是针对.NET的一款代码生成工具,同时它的很多自带模版几乎都是针对SQL Server构架的系统,当在在使用Oracle 的时候,由于PL-SQL与T-SQL各个方面的差别,导致许多模版需要自定义,甚至需要重写许多模版,由于大多数人在使用Oracle数据库的时候使用下划线的风格来命名变量,而在.NET开发中有不提倡使用带下划线的方式来命名变量,于是本人决定在CodeSmith的模版中来转换这一风格,在CodeSmith中加入以后模版代码:
在codesmith中去掉oracle下划线(图一)在codesmith中去掉oracle下划线(图二)转换代码

Code highlighting PRodUCed by Actipro CodeHighlighter (freeware)
http://www.CodeHighlighter.com/

--> 1在codesmith中去掉oracle下划线(图三)<script runat="template">
 2在codesmith中去掉oracle下划线(图三)public string GetFixName(string strVal)
 3在codesmith中去掉oracle下划线(图二)在codesmith中去掉oracle下划线(图一)在codesmith中去掉oracle下划线(图四){
 4在codesmith中去掉oracle下划线(图五) 
 5在codesmith中去掉oracle下划线(图五) string strReturnVal = "";
 6在codesmith中去掉oracle下划线(图五) string[]strVals = strVal.Split('_');
 7在codesmith中去掉oracle下划线(图五) foreach(string str in strVals)
 8在codesmith中去掉oracle下划线(图六)在codesmith中去掉oracle下划线(图七) 在codesmith中去掉oracle下划线(图四){
 9在codesmith中去掉oracle下划线(图五)  strReturnVal += str.Substring(0,1) + str.Substring(1).ToLower();
10在codesmith中去掉oracle下划线(图八) }
11在codesmith中去掉oracle下划线(图五) return strReturnVal;
12在codesmith中去掉oracle下划线(图九)}
13在codesmith中去掉oracle下划线(图三)</script>

    当要使用表名、表字段映射成对象的对象、对象字段属性进程是,可以通过上述函数转化原来的名称,以到达与.NET 编码规范统一的效果。


发表评论 共有条评论
用户名: 密码:
验证码: 匿名发表