Entity Framework底层操作封装V2版本(8)

现在需要说说,需要注意的问题:在使用这个架子的时候一定需要注意的是:连接串一定要在配置文件里面定义好:库1 库2的连接串需要预先定义的。

[html] view plaincopy在CODE上查看代码片派生到我的代码片
 
  1. <connectionStrings>  
  2.   <add name="EntitiesContainer" connectionString="metadata=res://*/Entities.csdl|res://*/Entities.ssdl|res://*/Entities.msl;provider=System.Data.SqlClient;provider connection string="Data Source=.;Initial Catalog=JFrameDB;User ID=sa;Password=123456;MultipleActiveResultSets=True"" providerName="System.Data.EntityClient" />  
  3.   <add name="EntitiesContainerTest" connectionString="metadata=res://*/Entities.csdl|res://*/Entities.ssdl|res://*/Entities.msl;provider=System.Data.SqlClient;provider connection string="Data Source=.;Initial Catalog=JFrameDBTest;User ID=sa;Password=123456;MultipleActiveResultSets=True"" providerName="System.Data.EntityClient" />  
  4. lt;/connectionStrings>  


第二个地方时,如果使用缓存类的时候,需要注意的在 Global

  protected void Application_Start(object sender, EventArgs e)
        {
            RegisterRoutes(RouteTable.Routes);
            new JFrame.Business.CommonCacheDataInit();
            
        }

中,预先要把数据实例化一次,不然第一次数据是空的。

调用这样的方法去预先实例化:

[csharp] view plaincopy在CODE上查看代码片派生到我的代码片
 
  1. using System;  
  2. using System.Collections.Generic;  
  3. using System.Linq;  
  4. using System.Text;  
  5.   
  6. namespace JFrame.Dal  
  7. {  
  8.    public class CommonCacheDataInit  
  9.     {  
  10.        public CommonCacheDataInit()   
  11.        {  
  12.            new SysControlAndRolesDal();  
  13.            new SysControlAndUserDal();  
  14.            new SysControlDal();  
  15.            new SysFunctionandRolesDal();  
  16.            new SysFunctionDal();  
  17.            new SysMenuDal();  
  18.            new SysOrgStructureDal();  
  19.            new SysRoleMenuDal();  
  20.            new SysRolesDal();  
  21.            new SysUserBaseDal();  
  22.            new SysUserMenuDal();  
  23.            new SysUserRoleDal();  
  24.            new SysOrgDepartmentDal();  
  25.            new SysOrgPositionDal();  
  26.            new SysPositionAndUserDal();  
  27.            new SysKnowLedgeDal();  
  28.            new SysAreaDal();  
  29.            new SysDataModelViewInfoDal();  
  30.            new SysDataBaseInfoDal();  
  31.            new SysDataColumsDal();  
  32.        }  
  33.     }  
  34. }  


 

还有就是,因为的架构思想很简单,就是业务层每个逻辑我一定是分开的,所以和部分人的想法不太一样,也请大家见谅了。

很多人喜欢把MVC和架构混为一谈,我也不是很展成,所以可能会有些出入在里面。

 

到现在 这套架子就算完成了。请大家多多支持。

http://blog.csdn.net/jacky4955/article/details/25415065

posted @ 2014-12-30 15:02  关中秦人  阅读(110)  评论(0编辑  收藏  举报