コード例 #1
0
        protected virtual T MakeRepository <T>(Func <IDbContext, object> factory, IDbContext dbContext)
        {
            var f = factory ?? _repositoryFactories.GetRepositoryFactory <T>();

            if (f == null)
            {
                throw new NotImplementedException("No factory for repository type, " + typeof(T).FullName);
            }
            var repo = (T)f(dbContext);

            Repositories[typeof(T)] = repo;
            return(repo);
        }