示例#1
0
 public StoreKeyAccessor(IValidatorValueStore validatorValueStore,
                         IStoreKeyGenerator storeKeyGenerator,
                         IHttpContextAccessor httpContextAccessor)
 {
     _validatorValueStore = validatorValueStore
                            ?? throw new ArgumentNullException(nameof(validatorValueStore));
     _httpContextAccessor = httpContextAccessor
                            ?? throw new ArgumentNullException(nameof(httpContextAccessor));
 }
示例#2
0
        public HttpCacheHeaderWithExclusionsMiddleware(
            RequestDelegate next,
            ILoggerFactory loggerFactory,
            IDateParser dateParser,
            IValidatorValueStore store,
            IStoreKeyGenerator storeKeyGenerator,
            IETagGenerator eTagGenerator,
            ILastModifiedInjector lastModifiedInjector,
            IOptions <ExpirationModelOptions> expirationModelOptions,
            IOptions <ValidationModelOptions> validationModelOptions,
            IOptions <ExcludedRouteModelOptions> excludedRouteModelOptions)
        {
            if (loggerFactory == null)
            {
                throw new ArgumentNullException(nameof(loggerFactory));
            }

            if (validationModelOptions == null)
            {
                throw new ArgumentNullException(nameof(validationModelOptions));
            }

            if (expirationModelOptions == null)
            {
                throw new ArgumentNullException(nameof(expirationModelOptions));
            }

            _next = next ?? throw new ArgumentNullException(nameof(next));

            _dateParser           = dateParser ?? throw new ArgumentNullException(nameof(dateParser));
            _store                = store ?? throw new ArgumentNullException(nameof(store));
            _storeKeyGenerator    = storeKeyGenerator ?? throw new ArgumentNullException(nameof(storeKeyGenerator));
            _eTagGenerator        = eTagGenerator ?? throw new ArgumentNullException(nameof(eTagGenerator));
            _lastModifiedInjector =
                lastModifiedInjector ?? throw new ArgumentNullException(nameof(lastModifiedInjector));

            _expirationModelOptions    = expirationModelOptions.Value;
            _validationModelOptions    = validationModelOptions.Value;
            _excludedRouteModelOptions = excludedRouteModelOptions.Value;

            _logger = loggerFactory.CreateLogger <HttpCacheHeadersMiddleware>();
        }
 public DefaultETagGenerator(IStoreKeyGenerator storeKeyGenerator, ETagType eTagType = ETagType.Strong)
 {
     _storeKeyGenerator = storeKeyGenerator;
     _eTagType          = eTagType;
 }