Facts that all ASP.NET vNext developers need to know

ASP.NET vNext – formally known as ASP.NET 5 .  While the details have been known for some time, it’s a good chance to look again at what is coming and how it will affect ASP.NET developers.

1. Combined Application Models

ASP.NET combines MVC, Web API, SignalR and Web Pages into one framework, collectively called MVC 6.  ASP.NET MVC 6 harmonizes controllers, views and models and no longer requires System.Web.

Why you need to know:
The gradual achievement of the ‘One ASP.NET’ vision is finally with us and the same code patterns work for the different technologies.  No longer will MVC act similar-but-different to Web API.    Microsoft has signaled the future of web application development.

2.  Two CLR Versions

There are two versions of .NET Framework – the regular .NET version and the new ‘Core’ Common Language Runtime (sometimes known as ‘CoreCLR’).   The full CLR is sometimes referred to as the ‘Desktop’ or ‘Full’ CLR.   The CoreCLR has nothing in the Global Assembly Cache and multiple versions can be installed side by side on the same machine.  The CoreCLR is a cut-down version and is optimized for high throughput with low memory – otherwise known as ‘Cloud Optimized’.  ASP.NET will run on either the ‘full’ CLR or the Core CLR, depending on what dependencies are needed.   The Core CLR is fully open source and available on GitHub, and runs on Linux/Unix/OSx via Mono.

Why you need to know:
ASP.NET applications developed for vNext will benefit from targeting the CoreCLR.  This will allow cross-platform deployment,  simpler deployment models and less problems from version conflicts.  But choices need to be made early in the project pipeline to ensure that Desktop CLR dependencies are not included in code.  The CoreCLR runs with a fraction of the memory required for the previous .NET frameworks.   Existing projects using technology such as MVC 5, Webforms, SignalR 2 or Entity Framework 6  will need to use the full CLR.

3. New Compiler

ASP.NET vNext uses the ‘Roslyn’ compiler, which is a managed compiler written in it’s own language (the C# compiler is written in C#).  Roslyn compiler technology is fast and enables true ‘edit and run’ capabilities.  There is no need to compile an ASP.NET application and deploy the binaries, as you can just deploy the code files and let it compile in place.  Roslyn is open source and hosted on Github.

Why you need to know:
Changing to a simpler deployment method will change the way ASP.NET applications are developed and deployed.    The ground-up rewrite of the way that C# and VB.NET are compiled will also change the toolsets available as Roslyn exposes detailed information about the compilation process, and theoretically allows you to develop your own implementation.

4. Dependency Injection everywhere

Dependency Injection is now a first-class .NET citizen, and the pattern appears everywhere, including MVC, WebAPI and SignalR – as already mentioned, in a harmonized way.

Why you need to know :
Dependency Injection (DI) is not a new pattern, but different parts of .NET have been using different flavours for a while.  There is now a unified model and if you’re not familiar with DI, now is the time to start learning.

5.  One simple project type

ASP.NET projects are no longer different types like ‘Web Application Projects’  and ‘Web Site Projects’.  In fact you don’t even need a .csproj or .vbproj file for a web project.   Instead, the project is directory based, and the key file is now called ‘project.json’.   The project.json file doesn’t include a list of files but simply lists the dependencies of the project.

Why you need to know :
Theoretically you’ve never needed Visual Studio to compile and run a project, but it was difficult to try.  With the advent of directory-based projects and no Microsoft-specific file formats, any decent text editor can become an ASP.NET editor.  This includes cross-platform text editor support, such as using Sublime Text on OSX.   As you can now build and run an ASP.NET project on OSX, it really is a true cross-platform solution.

6.  Changes to the Application Pipeline

The ASP.NET pipeline has been re-invented.   Understanding and manipulating the ASP.NET pipeline was always difficult, and there was no concrete guarantee that modules listed in a web.config file would execute in the expected order.  Not only is the web.config file gone, but you can also explicitly specify the pipeline execution components and order.   This is done in the simple ‘Startup’ class used in ASP.NET applications.

Why you need to know:
The traditional httpModule/httpHandler model is now a specific programming order instead of a set of components listed in configuration.  That may sound difficult to use in a production environment but the truth is that a binary-compilation and deployment is not necessary, so changing the pipeline is as simple as changing the order of code in the Startup class.

7.  Open Source Everywhere

Just about all of ASP.NET is now open source and hosted on Github.   There was once a debate that you couldn’t call open source projects like DNN ‘true’ open source because there were closed parts of the stack.   If you now run Linux-Mono-.NET with Roslyn compile you have a completely open stack from top to bottom.

Why you need to know:
We are in a new era of Microsoft tools and frameworks.  The release cycle of years gone by when a fully formed new version dropped every year or so is a relic of the past.  You can now observe the next generation of tools being developed in real time – and you can also participate by finding and fixing bugs in the core implementation.

Previous Post Next Post