public UnitOfWork(NgSchoolsContext context) { this.context = context; this.context.ChangeTracker.QueryTrackingBehavior = QueryTrackingBehavior.NoTracking; if (repositoryProvider == null) { repositoryProvider = new RepositoryProvider(); } repositoryProvider.DbContext = context; }
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); }
public UserRepository(NgSchoolsContext context) { this.context = context; }
public RepositoryBase(NgSchoolsContext context) { this.context = context; }