What’s New in ASP.NET Core 2.0?

As a part of its objectives to enable a more synchronized and consistent .NET platform, Microsoft had rolled out .NET Core 2.0, .NET Standard 2.0, and ASP.NET Core 2.0 in August 2017. For a .net development company in India, this means a lot of exciting new updates and holds tremendous potential for better customer servicing.

As one of the leading experts in custom .net development, we have had the chance to work on ASP .NET Core 2.0 and have come across a list of interesting new features. Want to know what these are? Then read on and be informed –

1 – Migration guide
With Microsoft’s comprehensive migration guide it becomes easy to transition from the current ASP.NET Core 1.Xto ASP.NET Core 2.0. Here are some important points for a smooth migration experience

  • The target framework needs to be re-configured for .NET Core 2.0
  • Explore the Microsoft.AspNetCore.Allmetapackage
  • Re-configure the Startup Class and Main Method

2 – Razor Pages and MVVC model
By using services.AddMvc(); in your Startup.ConfigureServices method, you can turn on Razor pages and the advantages brought about by MVVC (Model-View-ViewController) model. With this you can essentially create Razor Pages view without a controller. This is interesting as it can provide a lot of help to programmers when working with big complex controllers.

3 – Better programming efficiencies
With features like LINQ (Language Integrated Query), developers can now do away with a lot of for/next looping with a more efficient one-liner loop. Another feature is the In-line Ternary operator that makes the ‘if’ statement a one-liner.

4 – Dependency Injection in Page Models
A page model helps to fetch data from multiple HTTP requests. It also helps initiate necessary call procedures. Hence it is vital that it communicates with the rest of the system properly. The new feature of dependency injection support for page models will be great news. All the custom .NET developer needs to do is add a constructor to receive the dependenciesneeded.

5 – Program and startup classes
program.cs has been made simpler with the new version of .NET Core 2.0. This is accomplished by restructuring the WebHostBuilder as a part of its template.
Startup classes to have been simplified. Configuration and Logging are now core services added to the WebHostBuilder. This removes the need for them to be configured in the Startup class. As they have already been configured in the WebHostBuilder, the configuration can be inserted in the constructor or any class. The Configuration method will now not need to get an iLoggerFactory parameter since this is already taken care of by the WebHostBuilder.

6 – Logging Filtering
Another enhancement allows .Net MVC Development experts to define the logging level associated with every logger and category. In the existing version, you would have to pass the configuration to each logger registration to use the same setup as defined in the loggerFactory.WithFilters helper. But in the new version, the loggingFactory.addConfigurationfor the entire application is called by the WebHostBuilder.

7 – New platform support
With a view to have universal applicability, Microsoft has added support for .NET to as many as six platforms. These include the macOS High Sierra, SUSE Linux Enterprise Server 12 SP2, and Debian Stretch.

8 – IHostingService
How good it would be to schedule services in the background the easy way? This is what the new IHostingService interface does. It allows developers to run background process which is distinct from the main application currently running. Examples may be recurring refresh or upload of data at specific intervals of time.
While it may look simply to consist of Start and Stop methods within the interface, it becomes extremely powerful when you want to execute a background process that is independent of the main application.

9 – Default razor compilation on publish
With the new ASP.NET Core 2.0, the Razor View will be compiled as a part of the application execution rather than a separate compilation through cshtml. For a custom .net development company, this results in faster startup and swifter initial responses.

To sign off
Any good .Net MVC Development expert will support the fact that the new .NET standard 2.0 has substantially increased the number of customized APIs (from 13,000 in v1.6 to 32,000 in v2.0). This in turn, helps to significantly extend the functionality and supporting business use cases. As an outcome the potential of custom .net development in India has improved significantly.
Make sure that when you Hire Asp.net core Developers, you check for their evolving competencies to cover these important tech updates.

You can get the latest version of .NET Core (this contains ASP.NET Core too) from the official dotnet site.