using Microsoft.AspNetCore.Mvc;
using Microsoft.Extensions.Options;
using Umbraco.Cms.Web.Common.Filters;
using Umbraco.Cms.Web.Common.ModelBinders;
using Umbraco.Cms.Web.Common.Validators;
namespace Umbraco.Cms.Web.Common.Mvc;
///
/// Options for globally configuring MVC for Umbraco
///
///
/// We generally don't want to change the global MVC settings since we want to be unobtrusive as possible but some
/// global mods are needed - so long as they don't interfere with normal user usages of MVC.
///
public class UmbracoMvcConfigureOptions : IConfigureOptions
{
///
public void Configure(MvcOptions options)
{
options.ModelBinderProviders.Insert(0, new ContentModelBinderProvider());
options.ModelValidatorProviders.Insert(0, new BypassRenderingModelValidatorProvider());
options.ModelMetadataDetailsProviders.Add(new BypassRenderingModelValidationMetadataProvider());
options.Filters.Insert(0, new EnsurePartialViewMacroViewContextFilterAttribute());
}
}