public EFDbContext GetCurrentDbContext() { if (DbContextContainer == null) { return(null); } return(DbContextContainer.GetCurrentDbContext()); }
private static DbContextContainer GetCurrentDbContext(IDbContextFactory factory) { if (factory == null) { throw new ArgumentNullException("factory"); } if (factory.DbContextContainer == null) { throw new Exception("没有配置CurrentDbContext"); } DbContextContainer currentDbContext = factory.DbContextContainer as DbContextContainer; if (currentDbContext == null) { throw new Exception("Current DbContext没有继承CurrentDbContext"); } return(currentDbContext); }