介紹一個基於ASP.NET MVC的架構Catharsis

來源:互聯網
上載者:User

    Catharsis是一個基於ASP.Net MVC的一個開源架構,之前在codeproject上看到的。在我的2011生活看板中也說到今年準備給OpenExpressApp增加B/S支援,所以最近花了幾天時間看了一下Catharsis,以下簡單介紹一下。

Catharsis介紹

  Web-application framework, multi-tier (5-tier) Architecture (SQL or XML is persitence, DAO as the only access point to get/store data -NHibernate 3.0, Facades as the only Business rule validation place, MVC pattern (Views on the RAZOR only) and UI (HTML, CSS and JQuery).

ASP.NET MVC 3.0 RC - Razor,
The Web-application framework gathering the best practices and design patterns.

Strongly OOP, multi-tier Architecture, NHibernate 3.0, XML, ADO.NET
VS 2010, .NET 4.0 (Contracts, Covariance, Named and Default parameters)

項目地址:http://catarsa.com

http://www.codeplex.com/Catharsis/

文檔:http://www.codeproject.com/KB/applications/Catharsis_part3.aspx

主介面:

架構圖

Solution結構

根據上面的架構圖,從一個樣本Solution可以看到各自對應的項目

通過嚮導產生實體對應的完整代碼

結合VS,Catharsis提供了Recipe來產生項目代碼檔案,在產生實體時可以自動產生各個層的對應代碼

Controller繼承體系

以下是架構對實體控制器的一個繼承體系,架構特意抽取了一個CodeList來儲存具有Code、Name的簡單列表的類,這個類可以使用smallint、tinyint來作為主鍵以減少資料庫儲存空間

  • CurrencyController:Currency為一個樣本實體,這個為特定實體控制器
  • CodeListController:具有Code、Name的一個內建實體控制器
  • EntityController:通用的具有讀寫行為的控制器(添加、更新、刪除)
  • ReadController:通用的具有讀取功能行為的控制器(查詢、列表、詳細資料)
  • WebController:not only for entity, IMasterModel introduced, service operations (ObjectBinding())
  • Controller: ASP.NET MVC架構的控制器
一些不足
  • 運行比較慢
  • 介面不太美觀
  • UI模板抽取不是很好
  • 沒有什麼太吸引我的地方
可借鑒的
  • 強OO、多層架構
  • 實體控制類的繼承
  • ASP.Net MVC的使用
  • 多語言的支援

 

由於沒有細看,很多具體實現還有待細看,畢竟我對B/S開發還有很多需要學習的,所以以上分享可能會有偏差

 

推薦:你可能需要的線上電子書 

我的新浪圍脖: http://t.sina.com.cn/openexpressapp    

歡迎轉載,轉載請註明:轉載自周金根 [ http://zhoujg.cnblogs.com/ ]

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在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.