public EFRepository(SnapTownDbContext dbContext) { this.dbContext = dbContext; //SERIALIZE WILL FAIL WITH PROXIED ENTITIES dbContext.Configuration.ProxyCreationEnabled = false; //ENABLING COULD CAUSE ENDLESS LOOPS AND PERFORMANCE PROBLEMS dbContext.Configuration.LazyLoadingEnabled = false; }
public UnitOfWork(SnapTownDbContext dbContext, IRepository <Media> mediaRepo, IRepository <Subscription> subscriptionsRepo, IRepository <User> usersRepo, IRepository <Town> townsRepo) { this.dbContext = dbContext; this.Media = mediaRepo; this.Subscriptions = subscriptionsRepo; this.Users = usersRepo; this.Towns = townsRepo; }