Beispiel #1
0
        static DBHelper getDBHelper(DbContext dbContext)
        {
            var dbConnection = dbContext.Database.GetDbConnection();
            var builder      = DBConfigRegister.GetInstance();

            builder.RegisterDBAccessBuild(dbLocation =>
            {
                return(new DBAccessBuild(DBType.MSSQL, dbConnection));
            });
            var    dbConnectionTypeName = dbConnection.GetType().Name;
            DBType dBType = DBType.MSSQL;

            switch (dbConnectionTypeName)
            {
            case "SqlConnection":
                dBType = DBType.MSSQL;
                break;

            case "MySqlConnection":
                dBType = DBType.MYSQL;
                break;

            case "OracleConnection":
                dBType = DBType.ORACLE;
                break;
            }
            var dBAccessBuild = new DBAccessBuild(dBType, dbConnection);
            var helper        = DBConfigRegister.GetDBHelper(dBAccessBuild);

            return(helper);
        }
Beispiel #2
0
        internal override DbContextInner GetDbContext()
        {
            dbLocation.ManageName = ManageName;
            var helper    = DBConfigRegister.GetDBHelper(dbLocation);
            var dbContext = new DbContextInner(helper, dbLocation);

            dbContext.UseSharding = true;
            return(dbContext);
        }
Beispiel #3
0
        DbContextInner getDbContext(string manageName)
        {
            var dbLocation = new CRL.DBLocation()
            {
                DataAccessType = DataAccessType.Default, ManageType = GetType(), ManageName = manageName
            };
            var helper    = DBConfigRegister.GetDBHelper(dbLocation);
            var dbContext = new DbContextInner(helper, dbLocation);

            return(dbContext);
        }