/// <summary> /// 根据参数获取数据库的DbContext /// </summary> /// <param name="conString">初始化参数,可为连接字符串或者DbContext</param> /// <param name="dbType">数据库类型</param> /// <param name="entityNamespace">实体命名空间</param> /// <returns></returns> public static IRepositoryDbContext GetDbContext(string conString, DatabaseType dbType, string entityNamespace) { IRepositoryDbContext dbContext = new RepositoryDbContext(conString, dbType, entityNamespace); dbContext.Database.CommandTimeout = 5 * 60; return(dbContext); }
/// <summary> /// 根据参数获取数据库的DbContext /// </summary> /// <param name="conString">初始化参数,可为连接字符串或者DbContext</param> /// <param name="dbType">数据库类型</param> /// <returns></returns> public static IRepositoryDbContext GetDbContext(string conString, DatabaseType dbType) { IRepositoryDbContext dbContext = new RepositoryDbContext(conString, dbType); dbContext.Database.SetCommandTimeout(5 * 60); return(dbContext); }