2. Db 静态类
2.1 获取非泛型仓储
var repository = Db.GetRepository();
2.2 获取泛型仓储
var entityRepository = Db.GetRepository<TEntity>();
2.3 获取带定位器泛型仓储
var locatorRepository = Db.GetRepository<TEntity, TDbContextLocator>();
2.4 获取 Sql
仓储
var sqlRepository = Db.GetSqlRepository();
2.5 获取 Sql
定位器仓储
var sqlLocatorRepository = Db.GetSqlRepository<TDbContextLocator>();
2.6 获取 Sql
代理对象
var sqlProxy= Db.GetSqlProxy<TSqlDispatchProxy>();
2.7 获取默认数据库上下文
var dbContext = Db.GetDbContext();
2.8 获取定位器数据库上下文
var locatorDbContext = Db.GetDbContext<TDbContextLocator>();
var locatorDbContext2 = Db.GetDbContext(typeof(TDbContextLocator));
2.9 创建新的默认数据库上下文
var dbContext = Db.GetNewDbContext();
2.10 创建新的定位器数据库上下文
var locatorDbContext = Db.GetNewDbContext<TDbContextLocator>();
var locatorDbContext2 = Db.GetNewDbContext(typeof(TDbContextLocator));
2.11 根据定位器类型获取仓储
var repository = Db.GetRepository<TEntity>(dbContextLocatorType);
2.12 获取 主从库
仓储
var msRepository = Db.GetMSRepository();
2.13 获取 Sql
主库定位器仓储
var msLocatorRepository = Db.GetMSRepository<TMasterDbContextLocator>();
2.14 获取特定定位器仓储
var msLocatorRepository = Db.GetDbRepository<TDbContextLocator>();