Page 12 - MSDN Magazine, May 2017
P. 12

Cutting EdgE DINO ESPOSITO ASP.NET Core for ASP.NET Developers
Most of the buzz aboutASP.NET Core is centered on the multi- platform experience it enables. While this is a huge achievement, it’s not necessarily a plus if you’re a regular ASP.NET user with a large code base of .NET 4.x code and no plans to leave the familiar IIS and Windows environment. In this case, what’s the value prop- osition of ASP.NET Core for such a regular ASP.NET developer?
At first the new platform might look completely different, as if someone sneakily moved your cheese elsewhere overnight. ASP.NET Core is new, rebuilt from the ground up, according to more mod- ern practices. This might or might not increase your programming power and your ability to address customers’ concerns. Nobody canrealisticallyanswerthatquestiononyourbehalf.Thiscolumn attempts to clear the ground from any hype, benchmarks, and tech- nology focus and go straight to the substance of things. If you’re OK with the current platform, which aspects of ASP.NET Core can capture your attention?
Common Practices Engineered in the Framework
When the ASP.NET team members designed the original ASP.NET framework, they took most of the best practices of Active Server Pages and engineered them into a new framework. In doing so, they also introduced a lot of new stuff, such as compiled and managed code, automatic postbacks, and server controls. ASP.NET Core fol- lows the same evolutionary pattern.
better code where a few additional levels of separation of concerns are forced by default. It’s not anything that you can’t already achieve with discipline, though.
For any form of greenfield development, ASP.NET Core is an excellent choice. Yet, being a brand-new framework, it has some unavoidable initial costs: Everyone on the team must become proficient with it. In addition, everyone must be, or become, proficient with the Model-View-Controller (MVC) application model. Not everything you can label as greenfield development is brand new. Reusing chunks of existing code, or at least existing skills (that is, data access or secu- rity skills), is desirable. How much of that is realistically possible? To addressthispoint,ASP.NETCorecomesintwoflavors.
Flavors of ASP.NET Core
In Figure 1, you see the Visual Studio 2015 dialog box to create a new project. (It’s essentially the same in Visual Studio 2017.)
The first template will create a classic, non-Core project. The other two templates can create an ASP.NET Core project for a different .NET Framework. It’s the first crossroad you face in your journey through the ASP.NET Core unexplored territory.
Opting for the full .NET Framework gives you access to any existing .NET class libraries, but limits hosting to only Windows and IIS. Figure 2 summarizes the differences.
Common development practices, such as initial loading of configu- ration data, dependency injection, NuGet packages, claims-based authentication and Razor improve- ments, are native features of the new framework. The new frame- work also has a different startup procedure, a much more modular request-response middleware and even a slightly more flexible infra- structure for defining controllers and views. ASP.NET Core is also a cross-platform framework and lets you develop applications and host them on Windows, as well as macOS and Linux. In a way, ASP.NET Core forces you to write
Figure 1 Creating a New ASP.NET Core Project in Visual Studio
8 msdn magazine


































































































   10   11   12   13   14