// 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.Core;
using Microsoft.AspNet.Mvc.OptionDescriptors;
using Microsoft.AspNet.Mvc.ReflectedModelBuilder;
namespace Microsoft.AspNet.Mvc
{
///
/// Provides programmatic configuration for the MVC framework.
///
public class MvcOptions
{
private AntiForgeryOptions _antiForgeryOptions = new AntiForgeryOptions();
private RazorViewEngineOptions _viewEngineOptions = new RazorViewEngineOptions();
public MvcOptions()
{
ApplicationModelConventions = new List();
ModelBinders = new List();
ViewEngines = new List();
ValueProviderFactories = new List();
OutputFormatters = new List();
InputFormatters = new List();
}
///
/// 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;
}
}
///
/// Get a list of the which are used to construct
/// a list of by .
///
public List OutputFormatters { get; private set; }
///
/// Get a list of the which are used to construct
/// a list of by .
///
public List InputFormatters { get; private set; }
///
/// Provides programmatic configuration for the default .
///
public RazorViewEngineOptions ViewEngineOptions
{
get
{
return _viewEngineOptions;
}
set
{
if (value == null)
{
throw new ArgumentNullException("value",
Resources.FormatPropertyOfTypeCannotBeNull("ViewEngineOptions",
typeof(MvcOptions)));
}
_viewEngineOptions = value;
}
}
///
/// Get a list of the used by the
/// .
///
public List ModelBinders { get; private set; }
///
/// Get a list of the s used by this application.
///
public List ModelValidatorProviders { get; } =
new List();
///
/// Gets a list of descriptors that represent used
/// by this application.
///
public List ViewEngines { get; private set; }
///
/// Gets a list of descriptors that represent
/// used by this application.
///
public List ValueProviderFactories { get; private set; }
public List ApplicationModelConventions { get; private set; }
}
}