ASP.NET CORE MVC Architecture

In this tutorial will discuss what is mvc and architecture of mvc.

MVC

The Model-View-Controller (MVC) architectural pattern separates an application into three main components: Models, Views, and Controllers. This pattern helps to achieve separation of concerns. Almost all the languages use MVC with slight variation, but conceptually it remains the same.

Using this pattern, user requests are routed to a Controller which is responsible for working with the Model to perform user actions and/or retrieve results of queries. The Controller chooses the View to display to the user, and provides it with any Model data it requires.

Model

The Model in an MVC application represents the state of the application and any business logic or operations that should be performed by it. A model can also contain the logic for persisting the state of the application.

Views

Views are responsible for presenting content through the user interface. A view should ideally contain minimal logic and it should only be related to presenting the content.

Controllers

Controllers are the components that handle user interaction, work with the model, and ultimately select a view to render. In the MVC pattern, the controller is the initial entry point and is responsible for selecting which model types to work with and which view to render. In other words, the controller controls how the app responds to a given request.

How MVC works

      1. Suppose user request to your web application
      2. First request goes to the controller.
      3. Controller process request and load appropriate model.
      4. Return response to view which is user able to see as end response.

ASP.NET Core MVC

The ASP.NET Core MVC is a lightweight, open source and highly testable framework which seamlessly integrates with the ASP.NET Core.

ASP.NET Core MVC provides a patterns-based way to build dynamic websites which enables a clean separation of concerns. It gives us full control over the markup, supports test-driven development and adheres to the latest web standards.

New Features

      • Routing
      • Model binding
      • Model validation
      • Dependency injection
      • Filters
      • Areas
      • Web APIs
      • Testability
      • Razor view engine
      • Strongly typed views
      • Tag Helpers
      • View Components

You can watch our video version of this tutorial with step by step explanation.