public EntityRepository(IDbContextProvider <TContext> contextProvider) { if (contextProvider == null) { throw new ArgumentNullException(nameof(contextProvider)); } this.Context = contextProvider.Create(); this.DbSet = this.GetDbSet <TEntity>(); }