// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. // Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. using System; using System.Collections.Generic; using Microsoft.AspNet.Mvc.ApplicationModels; using Microsoft.AspNet.Mvc.Core; using Microsoft.AspNet.Mvc.ModelBinding; using Microsoft.AspNet.Mvc.ModelBinding.Metadata; using Microsoft.AspNet.Mvc.ModelBinding.Validation; namespace Microsoft.AspNet.Mvc { /// /// Provides programmatic configuration for the MVC framework. /// public class MvcOptions { private AntiForgeryOptions _antiForgeryOptions = new AntiForgeryOptions(); private int _maxModelStateErrors = ModelStateDictionary.DefaultMaxAllowedErrors; public MvcOptions() { Conventions = new List(); ModelBinders = new List(); ViewEngines = new List(); ValueProviderFactories = new List(); OutputFormatters = new List(); InputFormatters = new List(); Filters = new List(); FormatterMappings = new FormatterMappings(); ValidationExcludeFilters = new List(); ModelMetadataDetailsProviders = new List(); ModelValidatorProviders = new List(); ClientModelValidatorProviders = new List(); CacheProfiles = new Dictionary(StringComparer.OrdinalIgnoreCase); } /// /// Provides programmatic configuration for the anti-forgery token system. /// public AntiForgeryOptions AntiForgeryOptions { get { return _antiForgeryOptions; } set { if (value == null) { throw new ArgumentNullException("value", Resources.FormatPropertyOfTypeCannotBeNull("AntiForgeryOptions", typeof(MvcOptions))); } _antiForgeryOptions = value; } } /// /// Used to specify mapping between the URL Format and corresponding /// . /// public FormatterMappings FormatterMappings { get; } /// /// Gets a list of which are used to construct filters that /// apply to all actions. /// public ICollection Filters { get; } /// /// Gets a list of s that are used by this application. /// public IList OutputFormatters { get; } /// /// Gets a list of s that are used by this application. /// public IList InputFormatters { get; } /// /// Gets a list of s that are used by this application. /// public IList ValidationExcludeFilters { get; } = new List(); /// /// Gets or sets the maximum number of validation errors that are allowed by this application before further /// errors are ignored. /// public int MaxModelValidationErrors { get { return _maxModelStateErrors; } set { if (value < 0) { throw new ArgumentOutOfRangeException(nameof(value)); } _maxModelStateErrors = value; } } /// /// Gets a list of s used by this application. /// public IList ModelBinders { get; } /// /// Gets a list of s used by this application. /// public IList ModelValidatorProviders { get; } /// /// Gets a list of instances. /// public IList ClientModelValidatorProviders { get; } /// /// Gets a list of descriptors that represent used /// by this application. /// public IList ViewEngines { get; } /// /// Gets a list of used by this application. /// public IList ValueProviderFactories { get; } /// /// Gets a list of instances that will be applied to /// the when discovering actions. /// public IList Conventions { get; } /// /// Gets or sets the flag which causes content negotiation to ignore Accept header /// when it contains the media type */*. by default. /// public bool RespectBrowserAcceptHeader { get; set; } /// /// Gets a Dictionary of CacheProfile Names, which are pre-defined settings for /// . /// public IDictionary CacheProfiles { get; } /// /// Gets a list of instances that will be used to /// create instances. /// /// /// A provider should implement one or more of the following interfaces, depending on what /// kind of details are provided: ///
    ///
  • ///
  • ///
  • ///
///
public IList ModelMetadataDetailsProviders { get; } } }