軟體程式碼生成之Codesmith模板.netTiers
阿新 • • 發佈:2018-12-30
.netTiers模板到2006年就誕生了, 到今天最後一次更新是12/17/2013, 支援.NET 4.5 and Visual Studio 2012 and 2013. netTiers是基於微軟企業庫的模板專案.
在今天各種PC端應用軟體橫行天下, 使用程式碼生成工具來提高開發效率是經常的事兒. netTiers構架設計是這樣的:
執行codesmith時,是這樣的:
上圖可以配置資料庫與表,是否生成UnitTest,WebService, 資料驗證的類庫, CRUD選項 ,基於微軟企業庫5.0, 目前支援SQL SERVER與Oracle
生成完後,會生成report.html, 最後生成VS2013的解決方案與專案:
上面有Service Layer, WebService, UnitTest, WinForm, 還有老式WebSite, 可惜不是MVC的前端. 但實際上稍加調整就可以了.
對於開發過N-Layer專案的您, 對這些不難理解.
其中Data Layer的基類UML:
專案中涉及的相關模式參考
ServiceLayer
http://martinfowler.com/eaaCatalog/serviceLayer.htmlProcessors
By default is a Pipeline:
http://www.enterpriseintegrationpatterns.com/PipesAndFilters.html
but easily can be used with workflow management in:
http://www.enterpriseintegrationpatterns.com/ProcessManager.html
Each Individual Processor uses a:
Command
http://www.dofactory.com/Patterns/PatternCommand.aspx
Flexible enough to be used within a strategy passed into the ctor to manage different behaviors in complex logic.
DomainModel + ActiveRecord
http://martinfowler.com/eaaCatalog/domainModel.html
http://martinfowler.com/eaaCatalog/activeRecord.html
Edit
Data Access Layer
Singleton, Decoratorhttp://msdn2.microsoft.com/en-us/library/ms998426.aspx
http://www.dofactory.com/Patterns/PatternDecorator.aspx
Data Transfer Objects:
http://martinfowler.com/eaaCatalog/dataTransferObject.html
Repository Provider:
http://davidhayden.com/blog/dave/archive/2004/05/19/259.aspx
Edit
Entity Layer
Each Entity - Memento, State, DomainModel, TableModulehttp://www.dofactory.com/Patterns/PatternMemento.aspx
http://www.dofactory.com/Patterns/PatternState.aspx#_self2
http://martinfowler.com/eaaCatalog/domainModel.html
http://martinfowler.com/eaaCatalog/tableModule.html
Entity Factory
http://www.dofactory.com/Patterns/PatternFactory.aspx
WebService Client - Proxy
http://www.dofactory.com/Patterns/PatternProxy.aspx
Sql Expression - Builder
http://www.dofactory.com/Patterns/PatternBuilder.aspx
更多介紹參考, 官方網站, 原始碼. 由於篇幅有限,今天先介紹到這兒.
您可能感興趣的文章:
如有想了解更多軟體開發資訊,請關注我的微信訂閱號:
作者:Petter Liu
出處:http://www.cnblogs.com/wintersun/
本文版權歸作者和部落格園共有,歡迎轉載,但未經作者同意必須保留此段宣告,且在文章頁面明顯位置給出原文連線,否則保留追究法律責任的權利。
該文章也同時釋出在我的獨立部落格中-Petter Liu Blog。