前段时间,学习Monorail和IBatis.Net,写了个小网站,呵呵,查看demo
有一个很强烈的感觉就是使用monorail更像是自己是在写网站,也许能体会到一些php开发者的乐趣。。这是以前用WebForm感受不到的,WebForm开发更像Winform。
Monorail和IBatis.Net架构,前期的一些配置还是比较繁琐的,基本的目录结构是这样的

大家都知道,Monorail是MVC,他的官方Sample中大致上是Content、Controller、Components、Views、Model这样的目录结构;Content目录中放我们的Js image和css文件。。Controller目录里只我们的控制器,View是我们的定义好的模板文件,Components里是一些自定义组件文件。
为了使用Ibatisnet,我只好把model拿到外面,变成了和Web同级的目录,这就是上图看到的Entity。。
上图中的的Business、Dao、Entity都是可以利用工具自动生成的。下载这个工具。
下面说说配置文件,还是先看目录结构

Maps目录里Ibatisnet使用的sql语句的config文件,config目录里面放的都是配置文件,全部有

components.config里面是注册我们自定义的component,内容如下。每个comonent id对应的cs代码文件都在在Components目录下面。
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<components>
<component id="DisplayTopWebsiteComponent" type="GTTOLCOM.Web.Components.DisplayTopWebsiteComponent, GTTOLCOM.Web"></component>
<component id="HeaderComponent" type="GTTOLCOM.Web.Components.HeaderComponent, GTTOLCOM.Web"></component>
<component id="DisplayNoticeComponent" type="GTTOLCOM.Web.Components.DisplayNoticeComponent, GTTOLCOM.Web"></component>
<component id="FooterComponent" type="GTTOLCOM.Web.Components.FooterComponent, GTTOLCOM.Web"></component>
<component id="DisplayCategoryComponent" type="GTTOLCOM.Web.Components.DisplayCategoryComponent, GTTOLCOM.Web"></component>
<component id="DisplaySiteInfoComponent" type="GTTOLCOM.Web.Components.DisplaySiteInfoComponent, GTTOLCOM.Web"></component>
<component id="DisplayPathLinksComponent" type="GTTOLCOM.Web.Components.DisplayPathLinksComponent, GTTOLCOM.Web"></component>
<component id="DisplayNavListComponent" type="GTTOLCOM.Web.Components.DisplayNavListComponent, GTTOLCOM.Web"></component>
<component id="DisplaySubmitAttentionComponent" type="GTTOLCOM.Web.Components.DisplaySubmitAttentionComponent, GTTOLCOM.Web"></component>
<component id="DisplayAddSiteInfoComponent" type="GTTOLCOM.Web.Components.DisplayAddSiteInfoComponent, GTTOLCOM.Web"></component>
<component id="DisplayUserPathLinksComponent" type="GTTOLCOM.Web.Components.DisplayUserPathLinksComponent, GTTOLCOM.Web"></component>
<component id="DisplayRssComponent" type="GTTOLCOM.Web.Components.DisplayRssComponent, GTTOLCOM.Web"></component>
<component id="DisplayTagListComponent" type="GTTOLCOM.Web.Components.DisplayTagListComponent, GTTOLCOM.Web"></component>
<component id="DisplayAllCommentsComponent" type="GTTOLCOM.Web.Components.DisplayAllCommentsComponent, GTTOLCOM.Web"></component>
<component id="DisplaySpecialSiteComponent" type="GTTOLCOM.Web.Components.DisplaySpecialSiteComponent, GTTOLCOM.Web"></component>
<component id="DisplayAddUrlsToolComponent" type="GTTOLCOM.Web.Components.DisplayAddUrlsToolComponent, GTTOLCOM.Web"></component>
</components>

</configuration>
Controlloer.config文件内容
<?xml version="1.0" encoding="utf-8" ?>
<configuration>

<components>
<component id="home.controller"
type="GTTOLCOM.Web.Controllers.HomeController, GTTOLCOM.Web" />
<component id="layout.controller"
type="GTTOLCOM.Web.Controllers.LayoutController, GTTOLCOM.Web" />
<component id="sitemanager.controller"
type="GTTOLCOM.Web.Controllers.SiteManagerController, GTTOLCOM.Web" />
<component id="Browse.controller"
type="GTTOLCOM.Web.Controllers.BrowseController, GTTOLCOM.Web" />
<component id="Account.controller"
type="GTTOLCOM.Web.Controllers.AccountController, GTTOLCOM.Web" />
<component id="FriendLinks.controller"
type="GTTOLCOM.Web.Controllers.FriendLinksController, GTTOLCOM.Web" />
<component id="Comments.controller"
type="GTTOLCOM.Web.Controllers.CommentsController, GTTOLCOM.Web" />
</components>

</configuration>
facilities.config的内容
<?xml version="1.0" encoding="utf-8"?>
<configuration>

<facilities>
<facility id="rails" type="Castle.MonoRail.WindsorExtension.MonoRailFacility, Castle.MonoRail.WindsorExtension" />

<facility
id="atm"
type="Castle.Facilities.AutomaticTransactionManagement.TransactionFacility, Castle.Facilities.AutomaticTransactionManagement" />

<facility
id="ibatis"
type="Castle.Facilities.IBatisNetIntegration.IBatisNetFacility, Castle.Facilities.IBatisNetIntegration">
<sqlMap id="sqlServerSqlMap" config="config/sqlMap.config" />
</facility>
<facility id="loggingfacility" configfile="config/log4net.config" loggingapi="log4net" type="Castle.Facilities.Logging.LoggingFacility, Castle.Facilities.Logging">
</facility>

</facilities>

</configuration>
log4Net.config内容
![]()
>
providers.configd内容
![]()
>
sqlMap.config内容
Web.config
ContainerBLL.cs和GlobalApplication.cs文件,这俩文件存放与Web根目录下面
相关文章:
-
2022-12-23
-
2022-12-23
-
2021-04-22
-
2021-05-14
-
2021-09-22
-
2022-12-23
-
2022-12-23
-
2022-12-23
猜你喜欢
-
2022-12-23
-
2022-12-23
-
2022-02-12
-
2021-11-07
-
2022-02-28
-
2021-05-14
-
2021-11-21
相关资源
-
下载
2022-12-12
-
下载
2021-07-01
-
下载
2023-01-07