As per Microsoft, .Net can now describe in one line and that is as follow.
Great, this is absolutely right. .Net is now .Net Core and known as Cross-Platform and Open Source platform where you can build your all types of applications. An application could be a web app, desktop app, mobile app or gaming app. All type apps can be created using a single platform and it’s none other than .Net Core.
Recently Microsoft announced new version of Asp.Net Core along with .Net Core and that is Asp.Net Core 2.0 which has new and amazing features which not only improve performance as well as increase productivity and enhance you application more robust and reliable. I am very excited to share features of Asp.Net Core 2.0.
You can use Asp.Net Core 2.0 with Visual Studio 2017 version 15.3. You can download .NET Core SDK 2.0 to avail these features. Asp.Net Core 2.0 has come up some new features. So, let’s start to understand not all but top 10 features of Asp.Net Core 2.0.
It is now much master than Asp.Net Core 1.x. It is now more than 20% faster than previous version. You can check it now with techempower.com as following URL shows. Just search aspnetcore on this URL, you will get the result.
We need to write few lines of code to achieve the same task. Just for example, Authentication is now easy with minimum line of code. When we talk about Program.cs class, Asp.Net Core 2.0 has minimum line of code in Main method as compare to previous version. With earlier version of Asp.Net Core, we need to setup everything in Main method like your web server “Kestrel”, your current directory, if you would like to use IIS than need to integrate IIS as well. But with Asp.Net Core 2.0, we don’t need to take care of these things; these will handle by CreateDefaultBuilder method automatically to setup everything.
Asp.Net Core 2.0 has introduced Razor Page to create dynamic pages in web application. Using Razor Pages, we can create simple and robust application using Razor features like Layout Pages, Tag Helpers, Partials Pages, Templates and Asp.Net features like code behind page, directive etc. Razor Page does follow the standard MVC pattern. Here we use different types of directive like @page, @model, @namespace, @using etc. on view page and respective code behind page inherited with PageModel class which is base class.
Razor page is simple a view with associate code behind class which inherit Page Model class which is an abstract class in “Microsoft.AspNetCore.Mvc.RazorPages“. It doesn’t use controller for view [.cshtml page] as we do in MVC but code behind works as like a controller itself. These pages [.cshtml] are not placed inside the Pages folder.
Choose Web Application as a template when you would like to create Razor Pages application in Asp.Net Core 2.0.
4.Meta Packages and Runtime Store
Asp.Net Core 2.0 comes with “Microsoft.AspNetCore.All” package which is nothing but a MetaPackage for all dependencies which are required when creating Asp.Net Core 2.0 application. It means once you include this, you don’t need to include any other packages or don’t need to dependent on any other packages. It is because “Microsoft.AspNetCore.All” supports .Net Runtime Core Store which contains all the runtime packages which are required for Asp.Net Core development.
Here you can see only one reference is added and that is “Microsoft.AspNetCore.All” with version 2.0.5. So, this meta package will take care for all other packages required on runtime using Runtime Store.
You don’t need to add any other packages from outside; all is here with meta package and don’t need to take care of multiple packages with different version, here only have one version 2.0.5 or 2.x.x.
When you expand this reference section, you will find all the related packages are already referred with this meta package as following image shown.
5..Net Standard 2.0
The .Net Standard is group of APIs which are supported by .Net Framework. As compare to previous version of .Net Standard 2.0 supports dubbed APIs in numbers. It around more than 3200+ APIs supported by .Net Standard 2.0.
Leave the exception cases but .Net Standard 2.0 supports 70% of APIs which are being used or can be used with .Net Framework.
Just for example, .Net Standard didn’t support Logging feature using Log4Net, so we are not able to use it with Asp.Net Core, but with .Net Standard 2.0, this is in. We can now use lots of feature which are part of .Net Framework but we were not using it in Asp.Net Core with .Net Standard 1.x. We can use .Net Framework along with .Net Standard 2.0.
So, now onwards we can use all related APIs with .Net Standard 2.0.
For more about read following article;
Asp.Net Core 2.0 comes with new SPA template which can be used with latest version of Angular 4, React.js, and Knockout.js with Redux. By default Angular 4 is implementing with all required pages and React is also same. When we application using SPA template than all required packages automatically will installed using NPM packages. You don’t need to take care of angular packages or typescript packages, it will install and give ready made project from where you can start your coding for next.
The packages “Microsoft.AspNetCore.Server.WebListener” and “Microsoft.Net.Http.Server” are now merged into one packages and that package is Microsoft.AspNetCore.Server.HttpSys. Respective to this, namespace is also update to implement Microsoft.AspNetCore.Server.HttpSys. So, from now rather than implementing two packages, we only need to implement one.
8.Razor View Engine with Roslyn
Asp.Net Core 2.0 is now supported Roslyn compiler and support C# 7.1 features. So, now we can get the benefit of Roslyn compiler in Asp.Net Core MVC application with Razor View Engine.9.Visual Basic Support
With this new release of .Net Core 2.0, Visual Basic is part of .Net Core programming language. Now we can create different type of application using Visual Basic code as well.
10.Output from Asp.Net Core Web Server
In the output window, now we can trace our application using the “Asp.Net Core Web Server” option. This will show you how our application is started and got rendered on the browser. So, each information from starting to render will get here.
So, today we have learned about top 10 features of Asp.Net Core 2.0.
I hope this post will help you. Please put your feedback using comment which helps me to improve myself for next post. If you have any doubts please ask your doubts or query in the comment section and If you like this post, please share it with your friends. Thanks