Introduction to ASP.NET Core Framework

Introduction to ASP.NET Core Framework

In this article, I am going to give you a brief introduction to ASP.NET Core Framework. Nowadays, when it comes to software development, everyone is talking about free, open-source, and cross-platform development. As we all know Microsoft is well known for its Windows-based products. Now we are in the new age of software development. For this, a new revolutionary product came into the market by Microsoft and it is ASP.NET Core. As part of this article, we are going to discuss the following pointers in detail.

  1. History of ASP.NET
  2. What is ASP.NET Core
  3. Why ASP.NET Core?
  4. Where can we develop applications using .NET Core?
  5. What the ASP.NET Core doesn’t have?
  6. .NET Core vs ASP.NET Core
  7. Language Support
History of ASP.NET

As we know, ASP.NET is the framework that has been used to develop data-driven web applications for many years. Since then, the ASP.NET Framework went through a steady evolutionary change, and finally, the most decent evolution is ASP.NET Core.

  1. The ASP.NET Core is not a continuous part of the ASP.NET 4.x Framework. Instead, it is a completely new framework.
  2. This Framework is an actual re-write of the current ASP.NET 4.x Framework, but with much smaller and a lot more modular.
  3. Some people think that many things remain the same, but that is not completely true. The ASP.NET Core is actually a big fundamental change to the ASP.NET Framework.
What is ASP.NET Core?

ASP.NET Core is the new version of the ASP.NET Web Framework mainly targeted to run on .NET Core Platform.

ASP.NET Core is a free, open-source, high-performance, light-weight, and cross-platform framework for building cloud-based applications, such as web apps, IoT apps, and mobile backend. It is designed to run on the cloud as well as on-premises.

Same as .NET Core, it was architected modular with minimum overhead, and then other more advanced features can be added as NuGet Packages as per application requirement. This results in high performance, require less memory, less deployment size, and easy to maintain.

ASP.NET Core Framework is completely rewritten of existing ASP.NET 4.x, with architectural changes that make it more modular, scalable, open-source, high-performance, lightweight, and a cross-platform web framework. 

The ASP.NET Core is an open-source framework supported by Microsoft and the community, so you can also contribute or download the source code from the ASP.NET Core Repository on GitHub (https://github.com/dotnet/aspnetcore)

ASP.NET Core 3.x application can be targeted to develop and run on top of the .NET Core only whereas ASP.NET Core 1.x and 2.x application can be targeted to develop and run on top of the .NET Core (Cross-platform) as well as .NET Framework (Windows only). For better understanding, please have a look at the following image.

ASP.NET Core Framework

Note: ASP.NET Core was initially launched as ASP.NET 5 but later it was renamed to ASP.NET Core.

Why ASP.NET Core?

Nowadays, the ASP.NET Core framework becomes more and more popular among developers. There are a number of reasons why modern developers are using it and some of them are listed below:

Open Source:

The ASP.NET Core framework is Open Source which is the main reason behind its popularity. The Entire Source Code of this .NET Core Framework is available at https://github.com/aspnet and you are free to download the source code and even if you want then you can also modify and compile your own version of it.

.NET Core team is always there to support your effort in the seamless development of the application. It receives bug fixing and improvement updates on a regular basis usually within a short time period. You don’t have to wait longer for updates. The flexibility in framework code is keeping it at the top of the developer’s choice. Depending upon the project’s requirements libraries and framework’s component can be added later.

Cross-Platform: 

The ASP.NET Core Framework is designed from scratch to keep in mind to be Cross-Platform for both development and deployment. So, we don’t need to build different applications for different platforms using different frameworks. Let us discuss what Cross-Platform is from the ASP.NET Core point of view by comparing it with the earlier versions of the ASP.NET Framework.

The earlier versions of ASP.NET Framework applications can only run on windows platforms whereas the ASP.NET Core applications can develop and run on different platforms such as Windows, Mac, or Linux operating systems. We can host the earlier ASP.NET Framework 4.x applications only on IIS whereas we can host the ASP.NET Core applications on IIS, Nginx, Docker, Apache, or even self-host deployment.

To develop ASP.NET Core applications, you have multiple options like you can use either Visual Studio or Visual Studio Code. If you want, then you can also use any third-party editors as per your choice.

CLI Support:  Using CLI commands you can develop and run .NET applications as well as you can also publish the application using CLI command.

Fast: ASP.NET Core no longer depends on System.Web.dll for browser-server communication. ASP.NET Core allows us to include packages that we need for the application. This reduces the request pipeline and improves performance and scalability.

IoC Container: One of the most important used design patterns in the real-time application is the Dependency Injection Design Pattern. It includes the built-in IoC (Inversion of Control) container for automatic dependency injection which makes it maintainable and testable.

Unified MVC and Web API Framework: 

The ASP.NET Core provides a unified programming model for developing both Web apps and Web APIs. That means a single controller class can be used to handle both. The Controller we create in ASP.NET Core (either Web APPs or Web APIs) application is going to inherit from the Controller base class and returns the IActionResult interface. The IActionResult interface provides several implementations. The built-in result types such as the JsonResult and the ViewResult and (like this there are so many result types available that we will discuss later) implement the IActionResult interface.

In the ASP.NET Core Web API application, the controller action method is going to return JsonResult. At the same time if it is an ASP.NET Core Web application, then the return type of the controller action method is going to be ViewResult. 

Testing and Maintainability:

You can easily test and maintain the applications developed using the ASP.NET Core MVC framework. This is possible because it allows you to separate different parts of your application into independent pieces and it also allows you to test them independently. The Testing frameworks such as xUnit and MOQ can be easily integrated into ASP.NET Core MVC application for simulating any scenario.

Integration with Modern UI Framework: It allows you to use and manage modern UI frameworks such as AngularJS/Angular, React JS, and Bootstrap, etc…

Handling Request and Response Pipeline: 

We can handle the request and response in the ASP.NET Core application by using the new Middleware Components. In earlier ASP.NET 4.x we generally use Handlers and Modules to handle the Request and Response pipeline. The ASP.NET Core Framework provides a lot of built-in Middleware Components and we can use those Middleware Components to handle the request and response pipeline. If you want, then also you can create your own middleware components and use them in the request-response pipeline. In a later article, we will discuss the Middleware Components in detail. We will also discuss how to create custom Middleware Components and how to use them in ASP.NET Core applications.

Hosting:

ASP.NET Core web application can be hosted on multiple platforms with any web server such as IIS, Apache, etc… It is not dependent only on IIS as a standard .NET Framework.

Code Sharing: It allows you to build a class library that can be used with .NET Frameworks such as .NET Framework 4.x or Mono. Thus, a single code base can be shared across frameworks.

Side-by-Side App Versioning: ASP.NET Core runs in .NET Core, which supports the simultaneous running of multiple versions of applications.

Extensible Framework:

The ASP.NET Core MVC Framework is designed to be highly extensible. That means you can create an application today, that can be extended to any levels in the future. Some of the key features provided by this framework that give it the extensible power are as follows.

  1. View Components
  2. Tag Helpers
  3. Routing

In our upcoming articles, we will discuss each of these features in detail.

Smaller Deployment Footprint:

ASP.NET Core application runs on .NET Core, which is smaller than the full .NET Framework. So, the application which uses only a part of .NET CoreFX will have a smaller deployment size. This reduces the deployment footprint.

Excellent developer tools:

ASP.NET Core comes with a lot of preloaded tools. Anybody would love to work with these tools due to their simplicity and ease. Using JetBrains, ReSharper, and other tools it very easy to build tests and other extraordinary applications.

Versatility: Apart from modern web application users can also create mobile and desktop applications. They can switch whenever they want.

Note: Many people are confused between ASP.NET Core and .NET Core. Please note that ASP.NET Core and .NET Core are not the same. They are different, just like ASP.NET and .NET Framework are different. .NET Core is a fast, lightweight, modular, and open-source framework for creating web applications, services that run on Windows, Linux, and macOS. So, it is a software platform on which ASP.NET Core applications run.

What the ASP.NET Core doesn’t have?

If you are coming from ASP.NET 4.x, then you will not find the following things in ASP.NET Core 

  1. The Global.asax file
  2. Web.Config file
  3. HTTP Handlers and HTTP Modules
  4. ASP.NET Page Life-Cycle model

.NET Core vs ASP.NET Core:

.Net Core:
  1. .NET Core is open-source and cross-platform
  2. .NET Core is a runtime to execute applications which ate build on it.
  3. Install .NET Core Runtime to run applications and install .NET Core SDK to build applications.
  4. .NET Core 3.1 – latest version
ASP.NET Core:
  1. Asp.net core is Open-source and Cross-platform
  2. ASP.NET Core is a web framework to build web apps, IoT apps, and mobile backend on top of .NET Core.
  3. There is no separate runtime and SDK are available for ASP.NET Core. .NET Core runtime and SDK includes ASP.NET Core libraries.
  4. ASP.NET Core 3.1 – latest version
  5. There is no separate versioning for ASP.NET Core. It is the same as the .NET Core versions.
Language Support:

Dot Net Core Framework supports the following language i.e. using the following languages you can develop .NET Core applications. We are going to use C# as the programming language in this course.

  1. C#
  2. F#
  3. Visual Basic (VB)
.NET Core GitHub Repository:

.NET Core Runtime: https://github.com/dotnet/runtime
.NET Core SDK: https://github.com/dotnet/sdk
ASP.NET Core GitHub Repository: https://github.com/dotnet/aspnetcore

The Latest version of .NET Core is 3.1 as of today date.
The latest version of ASP.NET Core also is 3.1 as of today’s date.
There is no separate versioning of ASP.NET Core. It is the same as the .NET Core Versions.

.NET Core is named “Core” because it includes core features of .NET Framework. The main objective of .NET Core is to make .NET Framework open-source and cross-platform compatible so that it can be used in resource-constrained environments. It includes minimum features that are required to run a basic .NET Core application and other advanced features that can be as a package from NuGet.

In the next article, I am going to discuss the ASP.NET Core Environment Setup required for developing ASP.NET Core application using Visual Studio. Here, in this article, I try to give a brief introduction to ASP.NET Core Framework. I hope this Introduction to ASP.NET Core Framework article will help you with your need. 

16 thoughts on “Introduction to ASP.NET Core Framework”

Leave a Reply

Your email address will not be published. Required fields are marked *