Please enable JavaScript.
Coggle requires JavaScript to display documents.
.Net Core API - Coggle Diagram
.Net Core API
.csProj
-
Target Framework -> net 5.0, net 3.1
-
-
Program.cs
Web Host Builder
Host Builder is an object -> used to add features in the project, created out of IHostBuilder
-
-
-
-
-
-
-
Startup.cs
2 Important Methods
Configure Services
-
-
app.AddController() -> will enable Controller support to this API. app.AddMVC() -> will add Views to this project
Confgirue
-
-
-
app.UseEndPoints() -> will help in setting mapping for Route. By default add endpoints.MapControllers() to move routing to Controllers.
-
Controller Class
-
inherits ControllerBase class. This class provides many methods and properties to handle the HTTP request.
-
-
Middleware
-
-
Pre-built Middlewares
-
-
-
-
Swagger
Open API Standards
The OpenAPI Specification, previously known as the Swagger Specification, is a specification for machine-readable interface files for describing, producing, consuming, and visualizing RESTful web services.
-
-
-
-
-
4 app methods
-
-
app.Map()
-
-
app.Map("/ThisPath", ThatMethod) -> ThatMethod(app) { app.Use() {} }
-
Routing
-
-
-
app.useEndpoints( endpoints => endpoints.MapControllers()) -> Instead of Conventional Routing use Attirbute Routing
-
Pass variables in Routing [Route("books/{id}/author/{authorid}")] -> id and authorid are the parameters
-
-
-
-
Model Binder
-
-
-
-
-
[BindProperty]
-
-
[BindProperties] can be used at Controller level. This will enable all the public properties in the Controller to be accepted as Body of HttpRequest
use [FromQuery], [FromForm], [FromRoute] and [FromHeader] with parameters in Action Mehtod