public virtual T MakeRepository <T>(Func <BPAContext, object> factory, BPAContext dbContext)
        {
            var f = factory ?? _repositoryFactories.GetRepositoryFactory <T>();

            if (f == null)
            {
                throw new NotImplementedException($"No factory for repository type, {typeof(T)}");
            }

            var repo = (T)f(dbContext);

            Repositories[typeof(T)] = repo;
            return(repo);
        }
示例#2
0
 public BPARepo()
 {
     DbContext = new BPAContext();
     SetContextDefaults();
     CreateRepositories();
 }
示例#3
0
 public Repository(BPAContext bpaDbContext)
 {
     _bpaDbContext = bpaDbContext;
     DbSet         = _bpaDbContext.Set <T>();
 }