Sections | |
---|---|
MVC - Localization | 10 |
MVC - Routing | 9 |
MVC - Razor Class Library | 3 |
MVC - Tag Helpers | 7 |
MVC - View Component | 4 |
33 |
-
A "hello world" MVC app.
-
Infer dependency from action parameter
There is no need for
[FromServices]
attribute anymore to inject a dependency to your action method.
-
Show how to generate and decode JSON Web Tokens.
-
Use Microsoft.AspNetCore.Mvc.ProblemDetails
Use
Microsoft.AspNetCore.Mvc.ProblemDetails
as part of your Web API error reply. It is implementing RFC 7807. It will make life easier for everybody. -
Extends Microsoft.AspNetCore.Mvc.ProblemDetails
Extend
Microsoft.AspNetCore.Mvc.ProblemDetails
to make it easier for day to day use. It will adjust what kind of information it shows based on your development environment.
We are exploring everything related to model binding in this section.
-
Model binding using a class and FromQuery attribute
Use
[FromQuery]
attribute to have MVC put all the query string values nicely in a class instead of using primitives e.g.int userId
. -
Model binding using a class and FromRoute attribute
Use
[FromRoute]
attribute to have MVC put all the route values nicely in a class instead of using primitives e.g.int userId
.
We are exploring various that an Action returns.
-
An example on how to return a file to the browser when you have a stream available.
-
An example on how to return a file to the browser when you have a path to a file on disk.
-
Makes it easy to returns JSON content from an action.
-
Return XML response using
Microsoft.AspNetCore.Mvc.Formatters.Xml
.
-
Generate automatic documentation for your Web API using Swagger specification and NSwag
-
Use attribute such as
OpenApiTag
to organize your API orOpenApiIgnore
to hide an API from the definition (using[ApiExplorerSettings(IgnoreApi = true)]
also works).
We are building a RSS/ATOM Output formatter starting from the very basic.
-
This is a very rudimentary RSS output formatter. It's valid but it does not do much other than providing RSS items.
-
Use
Microsoft.AspNetCore.Mvc.NewtonsoftJson
to have MVC useNewtonsoft.Json
instead ofSystem.Text.Json
.
dotnet8