Entity Framework底层操作封装V2版本(8)
现在需要说说,需要注意的问题:在使用这个架子的时候一定需要注意的是:连接串一定要在配置文件里面定义好:库1 库2的连接串需要预先定义的。
- <connectionStrings>
- <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" />
- <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" />
- lt;/connectionStrings>
第二个地方时,如果使用缓存类的时候,需要注意的在 Global
protected void Application_Start(object sender, EventArgs e)
{
RegisterRoutes(RouteTable.Routes);
new JFrame.Business.CommonCacheDataInit();
}
中,预先要把数据实例化一次,不然第一次数据是空的。
调用这样的方法去预先实例化:
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- namespace JFrame.Dal
- {
- public class CommonCacheDataInit
- {
- public CommonCacheDataInit()
- {
- new SysControlAndRolesDal();
- new SysControlAndUserDal();
- new SysControlDal();
- new SysFunctionandRolesDal();
- new SysFunctionDal();
- new SysMenuDal();
- new SysOrgStructureDal();
- new SysRoleMenuDal();
- new SysRolesDal();
- new SysUserBaseDal();
- new SysUserMenuDal();
- new SysUserRoleDal();
- new SysOrgDepartmentDal();
- new SysOrgPositionDal();
- new SysPositionAndUserDal();
- new SysKnowLedgeDal();
- new SysAreaDal();
- new SysDataModelViewInfoDal();
- new SysDataBaseInfoDal();
- new SysDataColumsDal();
- }
- }
- }
还有就是,因为的架构思想很简单,就是业务层每个逻辑我一定是分开的,所以和部分人的想法不太一样,也请大家见谅了。
很多人喜欢把MVC和架构混为一谈,我也不是很展成,所以可能会有些出入在里面。
到现在 这套架子就算完成了。请大家多多支持。
http://blog.csdn.net/jacky4955/article/details/25415065