.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. http://www.dofactory.com/Patterns/PatternStrategy.aspx
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。