diff --git a/aspnetcore/mvc/models/validation.md b/aspnetcore/mvc/models/validation.md index c83be2aaac..33483f6b5a 100644 --- a/aspnetcore/mvc/models/validation.md +++ b/aspnetcore/mvc/models/validation.md @@ -4,7 +4,7 @@ author: tdykstra description: Learn about model validation in ASP.NET Core MVC. ms.author: riande ms.custom: mvc -ms.date: 11/06/2018 +ms.date: 01/04/2019 uid: mvc/models/validation --- # Model validation in ASP.NET Core MVC @@ -78,7 +78,7 @@ Model state represents validation errors in submitted HTML form values. MVC will continue validating fields until it reaches the maximum number of errors (200 by default). You can configure this number with the following code in `Startup.ConfigureServices`: -[!code-csharp[](validation/sample/Startup.cs?range=27)] +[!code-csharp[](validation/sample/Startup.cs?name=snippet_MaxModelValidationErrors)] ## Handle Model State errors diff --git a/aspnetcore/mvc/models/validation/sample/Startup.cs b/aspnetcore/mvc/models/validation/sample/Startup.cs index 6f73b17be1..f25ba0a890 100644 --- a/aspnetcore/mvc/models/validation/sample/Startup.cs +++ b/aspnetcore/mvc/models/validation/sample/Startup.cs @@ -11,8 +11,10 @@ namespace MVCMovie { services.AddSingleton(new MVCMovieContext()); services.AddSingleton(new UserRepository()); + #region snippet_MaxModelValidationErrors services.AddMvc(options => options.MaxModelValidationErrors = 50) .SetCompatibilityVersion(CompatibilityVersion.Version_2_2); + #endregion } public void Configure(IApplicationBuilder app)