Hello everyone, I hope you all are doing great. Today, I am going to start this new series on ASP.NET Core and it’s our first tutorial in this series. I will start from basics and will slowly move towards complex concepts. So, if you haven’t worked on ASP.NET then you don’t need to worry about that but you must have some basic knowledge of C# and object oriented programming.
I will use Visual Studio 2019 for these tutorials, it’s community version is free to use and I will use C# language for developing ASP.NET Core web applications. So, let’s first have a look at what is ASP.NET Core:
Introduction to ASP.NET Core
- ASP.NET Core (originally deemed as ASP.NET xNext & was going to named as ASP.NET 5) is an open source, modular, cross platform and high performance Framework used to build advanced cloud based Internet Applications i.e.
- Web Application.
- Android Application.
- IOS Application.
- It’s built ( rewrite ) completely from scratch by Microsoft & its vast community (as its open source) and combines ASP.NET MVC & ASP.NET Web API in a single package, which were previously available as separate entities.
- Although Core is a completely new framework but still it has quite a lot of resemblance with ASP.NET so if you have already worked on ASP.NET then Core won’t be that difficult for you.
- As ASP.NET Core is an open source framework, so you can download or update its code from respective repositories on Github.
Why use ASP.NET Core ?
Let’s have a look at few benefits of using ASP.NET Core:
1. Cross Platform
- The first & foremost advantage of ASP.NET Core is Cross Platform accessibility. In ASP.NET, you can only host your application on Windows platform but that’s not the case with ASP.NET Core, you can host its applications across different platforms i.e.
- Or any self host server.
2. Unified Programming Model
- ASP.NET Core follows Unified Programming Model, that’s why both MVC & API Controller classes inherit from single Controller base class, which returns IActionResult.
- IActionResult, as the name implies, is an Interface and has a lot of implementations and two of most commonly used are:
- In case of Web Apis, we get JsonResult and in case of Web MVC we can get both of them.
- In previous versions of ASP.NET, we have separate Controller classes for Web MVC & Web API.
3. Dependency Injection
- ASP.NET Core also has builtin support for dependency Injection, which makes it too flexible and conventional to use.
- Normally we use class constructors to inject dependencies and is called Constructor Injection.
- We will cover them in detail in upcoming tutorials, so if you are not getting this stuff then no need to worry.
4. Modular Framework
- ASP.NET Core also follows modular framework and uses middle-ware components which makes the flow of the app smooth.
- Microsoft has provided a lot of built-in middle-ware components for different purposes i.e. authentication, verification, File Fetching etc.
- We can also create custom middle-ware components as well in AP.NET Core.
5. Open Source
- ASP.NET Core is an open source framework and thus has a vast community on GitHub and Forum etc., that’s why it’s evolving rapidly and has become extremely powerful.
- You can get detailed and instant help on Core online quite easily.
6. Development Environment
- We can use Microsoft Visual Studio or Microsoft Visual Code for building our ASP.NET Core Applications.
- We can also use third party editors i.e. sublime etc. for ASP.NET Core.
Prior Knowledge Required for this Course
- If you haven’t studied ASP.NET then no need to worry as we are gonna start from scratch and will cover all concepts.
- But you must have good understanding of C# concepts, so if you are not that good in C# then you should first read this C# Tutorial.
Setting up Environment for ASP.NET MVC
- We can use any Integrated Development Environment (IDE) for ASP.NET MVC i.e. visual studio, visual code, sublime, atom etc.
- We will also need to install .NET Core SDK, which is a software development kit.
- Microsoft Visual Studio Community Edition is free to use and you can download it from its official website.
- Once you downloaded a simple setup of around 1.5MB, you need to run that .exe file and it will start downloading the setup files, as shown in figure on right side.
- Once it’s downloaded all the required files to start the setup, a new window will open up as shown in below figure:
- That’s called workload area of Visual Studio, here you need to select which tools, you want to install on your machine.
- I am going to select these 3 options from this list:
- As of this tutorial, the latest version available is Microsoft Visual Studio Community Edition 2019 and .NET Framework version is 4.7.2 (latest stable version), which will be automatically installed along with visual studio.
- If you are using any third party editor i.e. sublime, then you need to download the .NET Core SDK and install it on your machine.
- .NET Core SDK is available for Windows, Linux, macOS and Docker.
So, that was for today. I hope you have enjoyed today’s tutorial and are ready to get your hands dirty with ASP.NET Core. In our next tutorial, we will create our first project in ASP.NET Core and will write some code. Till then take care & have fun !!!