Book Image

ASP.NET Core MVC 2.0 Cookbook

By : Jason De Oliveira, Engin Polat, Stephane Belkheraz
Book Image

ASP.NET Core MVC 2.0 Cookbook

By: Jason De Oliveira, Engin Polat, Stephane Belkheraz

Overview of this book

The ASP.NET Core 2.0 Framework has been designed to meet all the needs of today’s web developers. It provides better control, support for test-driven development, and cleaner code. Moreover, it’s lightweight and allows you to run apps on Windows, OSX and Linux, making it the most popular web framework with modern day developers. This book takes a unique approach to web development, using real-world examples to guide you through problems with ASP.NET Core 2.0 web applications. It covers Visual Studio 2017- and ASP.NET Core 2.0-specifc changes and provides general MVC development recipes. It explores setting up .NET Core, Visual Studio 2017, Node.js modules, and NuGet. Next, it shows you how to work with Inversion of Control data pattern and caching. We explore everyday ASP.NET Core MVC 2.0 patterns and go beyond it into troubleshooting. Finally, we lead you through migrating, hosting, and deploying your code. By the end of the book, you’ll not only have explored every aspect of ASP.NET Core MVC 2.0, you’ll also have a reference you can keep coming back to whenever you need to get the job done.
Table of Contents (26 chapters)
Title Page
Copyright and Credits
Packt Upsell
Contributors
Preface
Index

What is ASP.NET Core 2.0?


This new version of ASP.NET is quite a revolution in the Microsoft ecosystem.

Before ASP.NET Core, ASP.NET was not open source, and ran only on Windows. To develop ASP.NET applications, most developers used Visual Studio as IDE. It was not mandatory, because we could use Notepad with CSharp or VB compilers (which were always free), but so much easier with VS even with an express edition. At that time, the only way to run .NET applications on Linux and macOS was to use Mono, an open source cross-platform version of the .NET Framework.

The ASP.NET Core version 2.0 is far more flexible. You can develop on any OS (at least Windows, Linux, and macOS), use various tools such as Visual Studio, Visual Studio Code, or even Sublime Text. ASP.NET Core is now modular, more maintenable, and has increased performance. By design, it is cloud-ready and middleware-based.

With the new version of ASP.NET, IIS is not the only possible host. You can host your ASP.NET applications on other web servers, such as Kestrel on macOS and Linux.

Among all the changes, some of the most important were the fusion of MVC and Web API, and the deletion of WebForms, Service locator, and System.Web.

All the duplicate libraries existing both in MVC and Web API, such as Controllers, Actions, Filters, Model Binding, and Dependency Resolver, are now the same unified classes.

The strong dependency on the heaviest library used in ASP.NET, System.Web, is now deleted to make ASP.NET Core MVC more modular, middleware-compliant, and platform-independent.

Note

All the source code for ASP.NET Core MVC is available in its GitHub repository at https://github.com/aspnet/mvc. We can find all the ASP.NET Core repositories at https://github.com/aspnet, and all the .NET Core repositories at https://github.com/microsoft/dotnet.