Beispiel #1
0
        DbContext getDbContext()
        {
            var dbLocation = new CRL.DBLocation()
            {
                DataAccessType = DataAccessType.Read, ManageType = typeof(T)
            };
            var helper    = SettingConfig.GetDbAccess(dbLocation);
            var dbContext = new DbContext(helper, dbLocation);

            return(dbContext);
        }
Beispiel #2
0
        internal override DbContext GetDbContext()
        {
            if (SettingConfig.GetDbAccess == null)
            {
                throw new CRLException("请配置CRL数据访问对象,实现CRL.SettingConfig.GetDbAccess");
            }
            var helper    = SettingConfig.GetDbAccess(dbLocation);
            var dbContext = new DbContext(helper, dbLocation);

            dbContext.ShardingMainDataIndex = mainDataIndex;
            dbContext.UseSharding           = true;
            return(dbContext);
        }