Blog Logo
TAGS

5 New MVC Features in .NET 7

Many new features were introduced in ASP.NET Core in .NET 7, including route groups, filters, and minimal APIs. However, MVC controllers were not forgotten, and this post discusses the new MVC features that were introduced. These include IParseable / TryParse for primitive binding, automatic inference for [FromServices], nullable annotations to infer required and optional parameters, support for IResult in MVC, and customized metadata providers that give better error names in responses. The model binding approach differs between minimal APIs and MVC, and this post explains the differences. Furthermore, a WeatherForecastController example is included to illustrate the use of query strings to control which days forecasts are shown for. Reading time is approximately 10 minutes. Author: Andrew Lock | .NET Escapades. Sponsored by MailBee.NET Objects, with new support for Office 365 OAuth 2.0. Reminder to check out Andrew Locks new book, ASP.NET Core in Action, Third Edition, updated for .NET 7 and with a discount code of au35loc at manning.com.