ASP.NET Core MVC is Microsoft’s Web Application development framework that is in great demand today. It is based on Model-View-Controller (MVC) architecture, ideas and techniques from Agile Development, and the best parts of .NET platform. In this tutorial I will introduce you with ASP.NET Core MVC.
Microsoft released ASP.NET Core MVC during the latter half of 2015. Over the past 3 years they have added new features to this framework making it more powerful. The current version of this platform as on today is 3.1 version. This tutorial series will teach you all the features of ASP.NET Core MVC so that you can create any sort of web application by your own.
This framework is bundled with some of the most amazing feature. These are:
You are free to download this framework’s source code from https://github.com/aspnet and even modify and compile your own version of it.
ASP.NET Core MVC is cross-platform both for development & deployment. It is available for all operating systems – Windows, Linux & macOS.
You can do development works in ASP.NET Core MVC using Visual Studio editor by Microsoft. Visual Studio works only on Windows & macOS.
For Linux, use Visual Studio Code editor.
In ASP.NET Core MVC you get full control over HTML. You can create, simple to complex type, HTML styled with CSS and display them on the browser.
Similarly you get full control over HTTP requests passed between the browser and server. Creating AJAX request is also very easy.
You can easily use client side libraries like jQuery, Angular, React & Bootstrap with ASP.NET Core MVC.
ASP.NET Core MVC is highly extensible. You can make applications that can be extended to any levels in future. Key features of this framework that gives it the extensible power are:
1. View Components
2. Tag Helpers
You will learn about all these features later on.
The ASP.NET Core MVC architecture is great for making your application maintainable and testable. You can separate, different areas of your application, into independent pieces and test them independently. Testing frameworks like xUnit & MOQ can be easily integrated for simulating any scenario.
ASP.NET Core MVC makes large to very large applications easy for maintaining.
ASP.NET Core MVC “Routing” makes SEO friendly URL which are easy to make and can be controlled from a single place. This removes the probability of error.
You don’t have to hard core the URL, instead the Routing will make it for you based on the structure which you have set.
Example of a SEO friendly URL is:
ASP.NET Core MVC APIs can take full advantage of language and runtime innovations familiar to C# programmers, like the await keyword, extension methods, lambda expressions, anonymous and dynamic types, and Language Integrated Query (LINQ).
To build your apps install .NET SDK which can be downloaded from here.
The codes on these series of tutorials require installation of Visual Studio 2019 (VS 2019), Community Edition on your PC. It requires Windows 8.1, 10 or higher version. It can also be installed on macOS.
For linux systems install Visual Studio Code.
The download link of VS is here- Download Visual Studio
The MVC Architecture is what ASP.NET Core is made from. MVC stands for Model-View-Controller, which are its 3 pieces.
There can be multiple Models, Controllers and Views in a MVC application.
Taking an example of a social community website like Facebook, a Model will contains all your details like – your name, ages, status, work info, your posts by date, your comments done on other profiles, your messages to other people, your liked pages and so on.
These details (your data) are filled on the Model by the Controller.
Models also help in preserving the business logic of the application (here for Facebook). For example when running paid ads in Facebook, Models will not allowed you to add invalid amounts on the ads. Example – ‘some amount’, ‘thirty’, ‘hello’ etc. It will also only proper amounts like ‘$10’, ’£20.50’, ‘$100’, etc
Models communicate with only Controllers and not with Views.
Views are the User Interface (UI) in MVC and are rendered on the browser. They can contain static HTML or dynamic HTML sent by the Controller. Views communicate only with the Controllers and not with Models.
Controller is responsible for rendering a particular View based on the request it gets from the browser.
Controller is the main thing in MVC. It sits between the View and the Model and communicates with them. All HTTP requests are received by the Controller, which after processing it, fills the data on the Model and sends the data on the View. The View is then rendered on the browser.
Controller contains simple to complex logic based on the working of the application.
I hope this introduction of ASP.NET Core MVC has taught you some good things about this excellent framework. The coming tutorial will take you direct to the coding.