天天看點

一起談.NET技術,Oxite 項目結構分析

<a href="http://www.codeplex.com/oxite" target="_blank"></a>

  Oxite中有6個Project,每個項目各自作為項目架構中的不同的層。下面我們來各自的分析一下這6個項目。

  我們可以看到這六個項目分别是Oxite,LinqToSqlDataProvider,MVC,Test,OxiteSite,(Oxite.Database 需要安裝SQL Server2005)。

<a href="http://images.cnblogs.com/cnblogs_com/binglingshui/WindowsLiveWriter/Oxite_819D/image_2.png"></a>

一起談.NET技術,Oxite 項目結構分析

  1. Oxite

  該項目中包含了Routing的定義,Model和Services服務層的代碼,還有Oxite運作時的背景服務類,配置類,同時,在該項目中也定義了資料通路層的接口,但并沒有實作。

<a href="http://images.cnblogs.com/cnblogs_com/binglingshui/WindowsLiveWriter/Oxite_819D/image_4.png"></a>

一起談.NET技術,Oxite 項目結構分析

BackgroundServices 定義了插件的服務類,

Extensions 則是各種常用方法的擴充,如IP位址,字元串,以及反射。

Handlers 對HttpHandler進行重載的類。用于對使用者請求進行操作。

Infrastructure 本目錄中有大量的類,定義了公用方法,

Model 這個對OO來說最容易了解,就是對象的定義,在MVC中的M。

Repositoris Oxite的資料通路層接口,使用了Repository模式,和Linq2SQL配合。

Routing 對Routing規則的定義和擴充。,同時也有相應的限制。

Services Oxite的服務層,也就是傳統三層架構中的中間服務層。内有服務的接口和具體實作。

Validation 一些常用的驗證方法。

  2. LinqToSqlDataProvider

  This project contains implementations of all the repositories and uses LinqToSql for data access. Currently it doesn't map the database directly to the entity objects but rather to an intermediate set of objects which are then translated into the standard Oxite entites. This is one of the areas we're looking at changing in a future release.

  該項目包據了資料通路層的實作,并用LinqToSql 進行資料庫的操作。

<a href="http://images.cnblogs.com/cnblogs_com/binglingshui/WindowsLiveWriter/Oxite_819D/image_6.png"></a>

一起談.NET技術,Oxite 項目結構分析

  這個Project中用到了LinqToSql,在項目架構中充當的是資料通路層的實作。

  3. MVC

  本項目中包含控制器和視圖層的所有代碼,用于Controllers到Views的資料通信,并包含用WCF所寫的MetaWeblog API用于提供對外服務。

<a href="http://images.cnblogs.com/cnblogs_com/binglingshui/WindowsLiveWriter/Oxite_819D/image_8.png"></a>

一起談.NET技術,Oxite 項目結構分析

ActionFilters 定義了各種攔截器

Controllers 所有的Controllers都在這個目錄下定義。

Extensions MVC架構中的一些方法擴充 BlogML,DateTime,HtmlHelper,HttpCookie

Infrastructure 基礎類

ModelBinders 作用是将用戶端送出的一個資料轉化成Model,簡單或複雜類型。為Action生成複雜對象參數

Results ?

Services 對外的一些服務接口。

Skinning 對主題皮膚操作的一些方法

ViewModels 從Controller中的資料綁定到View時所用到。

ContainerFactory 反射工廠

OxiteApplication.cs 将Globle中的方法轉移到這裡,将Site項目隻負責項目的顯示。

  4.MVC.Test

  該項目定義了整個解決方案的測試類,使用Xunit.net 測試架構。

  5.Site

  該項目包含視圖,主題和Web.Config檔案。并将所有的C#代碼放在了Oxite.Mvc項目中。

<a href="http://images.cnblogs.com/cnblogs_com/binglingshui/WindowsLiveWriter/Oxite_819D/image_10.png"></a>

一起談.NET技術,Oxite 項目結構分析

Site項目中是沒有C#代碼的,隻負責視圖的顯示。

Content 一些公用的内容,像公用圖檔,公用腳本,公用資源

Skins 皮膚。裡面包含了主題所使用的樣式檔案和Scripts。 (我個人感覺将一些公用的Scripts放到Content下更合适。)

Views 視圖Shared 公用的東東。像Error,MasterPage

  6. Oxite.Database

  資料庫項目,友善資料庫架構、資料的對比、更新與部署。