Lesson 01. ASP.NET 5.0 MVC (Project Files Arrangement)

Lesson 01. ASP.NET 5.0 MVC (Project Files Arrangement)

Components of .NET

  • Entity Framework Core - Modern object-database mapper for .NET. It?supports LINQ queries, changes tracking, updates, and schema migrations.
  • Identity Core - Provides a framework for managing and storing user accounts in ASP.NET Core apps.
  • MVC core - A lightweight, open source, highly testable presentation framework optimized for use with ASP.NET Core.
  • ?Razer Core - A new type of project where there is no need to write controllers and the controller logic and the routing can be placed in the view page itself.
  • SignalR?- Open-source library that simplifies adding real-time web functionality to apps.



Let's look at files that are created in the ASP.NET Core 5.0 MVC project

  • Project.csproj - The first thing that we want to look at is the actual project file.

No alt text provided for this image



  • Program.cs

No alt text provided for this image

Host.CreateDefaultBuilder() - will create a default web host okay so it's going to configure the web host using the default settings therefore it uses a web builder and then it starts.

Key Concepts you must know

Dependency injection is a technique whereby one object or static method supplies the dependencies of another object. A dependency is an object that can be used so it's a service.

class should depend on abstraction and not upon concretions so in simple terms it shouldn't be hard code



  • Startup file, .Net Core Pipeline and Middleware

No alt text provided for this image

Routing mechanism in .Net Core

There are different routing mechanisms in net core. The ways to configure routing in any application.

  1. Controllers.
  2. Razor Pages.
  3. gRPC services.
  4. End-point-enabled middleware.
  5. Delegates and lambdas registered with routing.

ASP.NET CORE controllers use he routing middleware to match the URLs of incoming requests and map them with the controller in action so we're going to see what controllers and actions.



  • Model, View and Controller

Model: The model represents the shape of the data. A class in C# is used to describe a model. Model objects store data retrieved from the database. (The model represents the data)

View: View in MVC is a user interface. View display model data to the user and also enables them to modify them. View in ASP.NET MVC is HTML, CSS, and some special syntax (Razor syntax) that makes it easy to communicate with the model and the controller. (The view is the User Interface)

Controller: The controller handles the user request. Typically, the user uses the view and raises an HTTP request, which will be handled by the controller. The controller processes the request and returns the appropriate view as a response. (The controller is the request handler)

要查看或添加评论,请登录

Hasitha Madusanka的更多文章

社区洞察

其他会员也浏览了