예제 #1
0
        public UnitOfWork(NgSchoolsContext context)
        {
            this.context = context;
            this.context.ChangeTracker.QueryTrackingBehavior = QueryTrackingBehavior.NoTracking;

            if (repositoryProvider == null)
            {
                repositoryProvider = new RepositoryProvider();
            }

            repositoryProvider.DbContext = context;
        }
예제 #2
0
        private T CreateRepository <T>(Func <NgSchoolsContext, object> factory, NgSchoolsContext dbContext)
        {
            Func <NgSchoolsContext, object> repositoryFactory;

            if (factory != null)
            {
                repositoryFactory = factory;
            }
            else
            {
                repositoryFactory = _factory.GetRepositoryFactoryFromCache <T>();
            }
            if (repositoryFactory == null)
            {
                throw new NotSupportedException(typeof(T).FullName);
            }
            T repository = (T)repositoryFactory(dbContext);

            Repositories[typeof(T)] = repository;
            return(repository);
        }
예제 #3
0
 public UserRepository(NgSchoolsContext context)
 {
     this.context = context;
 }
예제 #4
0
 public RepositoryBase(NgSchoolsContext context)
 {
     this.context = context;
 }