Update: Ilungasoft Framework v1.0.2 beta with sample
如果您不了解Ilungasoft Framework,请先参考:基于.Net 2.0 (C# 2.0, ASP.NET 2.0)的快速Web开发框架设计(文章索引)和ASP.Net 2.0 - 使用Ilungasoft Framework加速Web开发。
更新
2006/3/20
v1.0.2
1)支持多个数据库源协同工作,只需指定web.config中的ConnectionString Name。
Sample中,新增创建第二个数据源的代码示例:
App_Code\Facade.cs
1using System;
2using System.Data;
3using System.Configuration;
4using System.Web;
5using System.Web.Security;
6using System.Web.UI;
7using System.Web.UI.WebControls;
8using System.Web.UI.WebControls.WebParts;
9using System.Web.UI.HtmlControls;
10
11public abstract class Facade : Ilungasoft.Framework.Data.Facade.DefaultGateway
12{
13 public static Ilungasoft.Framework.Data.Facade.Gateway Gateway2 = new Ilungasoft.Framework.Data.Facade.Gateway("DatabaseConnection2");
14}
2using System.Data;
3using System.Configuration;
4using System.Web;
5using System.Web.Security;
6using System.Web.UI;
7using System.Web.UI.WebControls;
8using System.Web.UI.WebControls.WebParts;
9using System.Web.UI.HtmlControls;
10
11public abstract class Facade : Ilungasoft.Framework.Data.Facade.DefaultGateway
12{
13 public static Ilungasoft.Framework.Data.Facade.Gateway Gateway2 = new Ilungasoft.Framework.Data.Facade.Gateway("DatabaseConnection2");
14}
App_Code\CachableFacade.cs
1using System;
2using System.Data;
3using System.Configuration;
4using System.Web;
5using System.Web.Security;
6using System.Web.UI;
7using System.Web.UI.WebControls;
8using System.Web.UI.WebControls.WebParts;
9using System.Web.UI.HtmlControls;
10
11public abstract class CachableFacade : Ilungasoft.Framework.Data.Facade.Web.DefaultCachableGateway
12{
13 public static Ilungasoft.Framework.Data.Facade.Web.CachableGateway Gateway2 = new Ilungasoft.Framework.Data.Facade.Web.CachableGateway(Facade.Gateway2);
14}
2using System.Data;
3using System.Configuration;
4using System.Web;
5using System.Web.Security;
6using System.Web.UI;
7using System.Web.UI.WebControls;
8using System.Web.UI.WebControls.WebParts;
9using System.Web.UI.HtmlControls;
10
11public abstract class CachableFacade : Ilungasoft.Framework.Data.Facade.Web.DefaultCachableGateway
12{
13 public static Ilungasoft.Framework.Data.Facade.Web.CachableGateway Gateway2 = new Ilungasoft.Framework.Data.Facade.Web.CachableGateway(Facade.Gateway2);
14}
注意上面两个文件中的Line 13。分别定义了第二个数据源Gateway2,对应web.config中名称为DatabaseConnection2的ConnectionString。
实际读写数据库时,访问Facade.XXX或CachableFacade.XXX将是操作web.config中定义的ConnectionStrings的最后一个数据连接。而Facade.Gateway2和CachableFacade.Gateway2则操作指定名称为DatabaseConnection2的ConnectionString对应的数据库。此处,因为DatabaseConnection2的ConnectionString正好是ConnectionStrings的最后一个数据连接,因此,两者都对应到这个数据库。
下载
Ilungasoft Framework v1.0.2 beta with sample
下载1.0.2文档