static private Get ( string dbConfigurationName ) : |
||
dbConfigurationName | string | |
Результат |
/// <summary> /// 得到工作单元对象 /// </summary> /// <param name="dbConfigurationName"></param> /// <returns></returns> public static IUnitOfWork Get(string dbConfigurationName) { Guard.NotNullOrEmpty(dbConfigurationName, "dbConfigurationName"); var key = string.Concat("__", dbConfigurationName, "__"); var ctx = NLite.Threading.Local.Get(key) as IUnitOfWork; if (ctx == null) { var cfg = DbConfiguration.Get(dbConfigurationName); ctx = cfg.CreateDbContext() as IUnitOfWork; NLite.Threading.Local.Set(key, ctx); } return(ctx); }
/// <summary> /// 根据dbConfigurationName 创建DbContext对象 /// </summary> /// <param name="dbConfigurationName"></param> public DbContext(string dbConfigurationName) : this(DbConfiguration.Get(dbConfigurationName)) { }