在codesmith中去掉oracle底線

來源:互聯網
上載者:User

CodeSmith是針對.NET的一款代碼產生工具,同時它的很多內建模版幾乎都是針對SQL Server構架的系統,當在在使用Oracle 的時候,由於PL-SQL與T-SQL各個方面的差別,導致許多模版需要自訂,甚至需要重寫許多模版,由於大多數人在使用Oracle資料庫的時候使用底線的風格來命名變數,而在.NET開發中有不提倡使用帶底線的方式來命名變數,於是本人決定在CodeSmith的模版中來轉換這一風格,在CodeSmith中加入以後模版代碼:
轉碼
1<script runat="template">
2public string GetFixName(string strVal)
3{
4
5 string strReturnVal = "";
6 string[]strVals = strVal.Split('_');
7 foreach(string str in strVals)
8 {
9 strReturnVal += str.Substring(0,1) + str.Substring(1).ToLower();
10 }
11 return strReturnVal;
12}
13</script> 當要使用表名、表欄位對應成對象的對象、對象欄位屬性進程是,可以通過上述函數轉化原來的名稱,以到達與.NET 編碼規範統一的效果。

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.