/// <summary> /// constructor. /// </summary> /// <param name="nextDelegate"></param> /// <param name="options"></param> /// <param name="environment"></param> public SpaMetadataMiddleware( RequestDelegate nextDelegate, IOptions <SpaMetadataOptions> options, IHostingEnvironment environment ) { _options = options.Value; _nextDelegate = nextDelegate ?? throw new ArgumentNullException(nameof(nextDelegate)); _jsonFormatting = environment.IsDevelopment() ? Formatting.Indented : Formatting.None; }
public SpaMetadataService(IModelMetadataProvider modelMetadataProvider, IMemoryCache memoryCache, IOptions <SpaMetadataOptions> options, IEnumerable <ITypeMetadataProcessor> typeMetadataProcessors, IEnumerable <IPropertyMetadataProcessor> propertyMetadataProcessors, IOptions <MvcJsonOptions> mvcJsonOptions ) { _typeMetadataProcessors = typeMetadataProcessors; _propertyMetadataProcessors = propertyMetadataProcessors; _modelMetadataProvider = modelMetadataProvider ?? throw new ArgumentNullException(nameof(modelMetadataProvider)); _memoryCache = memoryCache ?? throw new ArgumentNullException(nameof(memoryCache)); _options = options.Value ?? throw new ArgumentNullException(nameof(options)); _modelSerializerSettings = _options.ModelSerializerSettings ?? mvcJsonOptions.Value.SerializerSettings; }