/// <summary> /// 初始化数据库连接字符串 /// </summary> private void InitDbConnectionStringConfig() { var dbConnectionStringConfig = new DbConnectionStringConfig(); dbConnectionStringConfig.MyShopConnectionString = ConfigManager.Configuration["ConnectionStrings:MyShop"]; DbConnectionStringConfig.InitDefault(dbConnectionStringConfig); }
/// <summary> /// 初始化数据库连接 /// </summary> private static void InitDbConnectionStringConfig() { var encryptKey = AppSettingUtil.EncryptKey; var dbConnectionStringConfig = new DbConnectionStringConfig(); var encryptConStr = ConfigurationManager.ConnectionStrings["VideoDBConnectionString"].ToString(); dbConnectionStringConfig.RolePermissionDbConnectionString = ManagePass.Decrypt(encryptConStr, encryptKey); DbConnectionStringConfig.InitDefault(dbConnectionStringConfig); Database.SetInitializer <VideoDbContext>(null); //是否使用with(nolock) DbInterception.Add(new NoLockInterceptor()); NoLockInterceptor.IsEnableNoLock = true; }