// Copyright (c) .NET Foundation. All rights reserved. // Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. using Microsoft.Extensions.DependencyInjection; namespace Microsoft.AspNetCore.Mvc { /// /// Specifies the version compatibility of runtime behaviors configured by . /// /// /// /// The best way to set a compatibility version is by using /// or /// in your application's /// ConfigureServices method. /// /// Setting the compatibility version using : /// /// public class Startup /// { /// ... /// /// public void ConfigureServices(IServiceCollection services) /// { /// services.AddMvc().SetCompatibilityVersion(CompatibilityVersion.Version_2_1); /// } /// /// ... /// } /// /// /// /// /// Setting compatiblity version to a specific version will change the default values of various /// settings to match a particular minor release of ASP.NET Core MVC. /// /// public enum CompatibilityVersion { /// /// Sets the default value of settings on to match the behavior of /// ASP.NET Core MVC 2.0. /// Version_2_0, /// /// Sets the default value of settings on to match the behavior of /// ASP.NET Core MVC 2.1. /// /// /// ASP.NET Core MVC 2.1 introduces compatibility switches for the following: /// /// /// /// MvcJsonOptions.AllowInputFormatterExceptionMessages /// RazorPagesOptions.AllowAreas /// /// Version_2_1, /// /// Sets the default value of settings on to match the behavior of /// ASP.NET Core MVC 2.2. /// /// /// ASP.NET Core MVC 2.2 introduces compatibility switches for the following: /// /// MvcDataAnnotationsLocalizationOptions.AllowDataAnnotationsLocalizationForEnumDisplayAttributes /// /// Version_2_2, /// /// Sets the default value of settings on to match the latest release. Use this /// value with care, upgrading minor versions will cause breaking changes when using . /// Latest = int.MaxValue, } }