public SampleEntityRepository( ApplicationDbContext applicationDbContext, IMemoryCache memoryCache, IOptions <FeatureSwitchesConfig> featureSwitchesConfig, IOptions <MemoryCachingConfig> memoryCachingConfig ) : base(applicationDbContext, memoryCache, featureSwitchesConfig, memoryCachingConfig) { _applicationDbContext = applicationDbContext ?? throw new ArgumentNullException($"{ClassNameExtension.GetCallingClassAndMethod(this)} : applicationContext was null"); _memoryCache = memoryCache ?? throw new ArgumentNullException($"{ClassNameExtension.GetCallingClassAndMethod(this)} : memoryCache was null");; _featureSwitchesConfig = featureSwitchesConfig.Value ?? throw new ArgumentNullException($"{ClassNameExtension.GetCallingClassAndMethod(this)} : featureSwitchesConfig was null");; _memoryCachingConfig = memoryCachingConfig.Value ?? throw new ArgumentNullException($"{ClassNameExtension.GetCallingClassAndMethod(this)} : memoryCachingConfig was null");; }
public GenericRepository( ApplicationDbContext dbContext, IMemoryCache memoryCache, IOptions <FeatureSwitchesConfig> featureSwitchesConfig, IOptions <MemoryCachingConfig> memoryCachingConfig ) { _dbContext = dbContext; _memoryCache = memoryCache; _featureSwitchesConfig = featureSwitchesConfig.Value; _memoryCachingConfig = memoryCachingConfig.Value; if ((_memoryCachingConfig.ShortCacheDurationSeconds < 1) || (_memoryCachingConfig.LongCacheDurationSeconds < 1)) { throw new ArgumentException($"{this.GetCallingClassAndMethod()} MemoryCachingConfig-> CacheDurationSeconds does not seem to be set correctly - check configuration."); } }