标签:blog io ar 使用 sp 数据 div on cti
public class BaseController : Controller { /// <summary> /// 用户中心Dbhelper /// </summary> public IDbHelper DbHelperUserCenter = GetDbConnection(BaseSystemInfo.UserCenterDbType, BaseSystemInfo.UserCenterDbConnection, ConfigHelper.GetConfigBool("BusinessDbEncrypt")); /// <summary> /// 业务库Dbhelper /// </summary> public IDbHelper DbHelperBusiness = GetDbConnection(BaseSystemInfo.BusinessDbType, BaseSystemInfo.BusinessDbConnection, ConfigHelper.GetConfigBool("UserCenterDbEncrypt")); /// <summary> /// 获得DbHelper /// </summary> /// <param name="currentDbType">数据库类别</param> /// <param name="dbConnection">连接字符串</param> /// <param name="dbEncrypt">是否加密</param> /// <returns>IDbHelper</returns> private static IDbHelper GetDbConnection(CurrentDbType currentDbType, string dbConnection, bool dbEncrypt = false) { if (dbEncrypt) { dbConnection= SecretUtil.Decrypt(dbConnection); } return DbHelperFactory.GetHelper(currentDbType, dbConnection); } .......... }
这里是mvc中基类的写法,其中提供了数据库使用加密方式后的解密方法。
标签:blog io ar 使用 sp 数据 div on cti
原文地址:http://www.cnblogs.com/hnsongbiao/p/4033459.html