Book Image

ASP.NET Core Essentials

By : Shahed Chowdhuri
Book Image

ASP.NET Core Essentials

By: Shahed Chowdhuri

Overview of this book

<p>ASP.NET Core is the latest collection of Microsoft’s web application development technologies. When you’re trying to reach a broad spectrum of users with a robust web application, ASP.NET Core is there to help you build that application. With the ability to cater to users on desktop, tablet, or smartphone platforms, you can put together a solution that works well anywhere.</p> <p>This book is what you need to get started developing ASP.NET Core applications was quickly as possible; starting by introducing the software and how it can be used in today’s modern world of web applications and smartphone apps. Walking you through the benefits of a Web API to support both applications and mobile apps to give you a solid understanding of the tech to build upon as you see what ASP.NET Core can do for you.</p> <p>The book wraps up with practical guidelines for the use of database technologies, unit tests, security best practices, and cloud deployments for the real world.</p>
Table of Contents (15 chapters)
ASP.NET Core Essentials
Credits
About the Author
About the Reviewer
www.PacktPub.com
Preface

ASP.NET Core - Unifying MVC, Web API, and Web Pages


When developers hear the term ASP.NET, some associate it with ASP.NET Web Forms, while others think of ASP.NET MVC or even Web API. Many developers have started their journey with Web Forms, and have migrated to Model-View-Controller (MVC) in recent years.

The adoption of ASP.NET MVC has been on the rise for years, due to its cleaner code and testability. While you can still develop Web Forms on .NET 4.x, you will be using MVC on .NET Core 1.0. Fortunately, ASP.NET Core runs on both .NET 4.5.1+ and .NET Core, so you can choose which runtime you would like to target.

Going forward, Microsoft has unified MVC, Web API, and Web Pages in ASP.NET Core. What does this mean for you, the developer? It means that you will enjoy more consistency when building your application with MVC, Web API, and Web Pages. In the past, MVC and Web API were implemented separately, leading to duplication and inconsistencies, but with ASP.NET Core, they have been merged into a single programming model.

High-level overview

If you're new to any of the preceding terms, here's a high-level overview:

  • ASP.NET MVC: Microsoft's implementation of the MVC architectural pattern, used for building test-friendly web applications that are robust yet lightweight.

  • Web API: Microsoft's answer to RESTful APIs, Web API allows developers to build HTTP services that can serve as a backend to web applications and mobile apps.

  • Web Pages: Microsoft's solution for creating lightweight dynamic websites. At the time of writing, Web Pages is not available in ASP .NET Core 1.0 so it will not be covered in this book.

The following figure illustrates a typical ASP.NET web application that uses both MVC and Web API. Note that Web API can be used to serve clients other than web browsers, such as mobile apps. It's important to mention that browsers here can include mobile web browsers as well:

Version numbers

You may have noticed that I mentioned MVC 6 while talking about ASP.NET Core. ASP.NET MVC 6 has been renamed ASP .NET Core 1.0 MVC. To keep track of all the new version numbers, the following is a handy list of what you need to know:

  • C# 6.0

  • ASP.NET Core:

    • Runs on .NET Core 1.0 or .NET Framework 4.5.1+

  • .NET Framework 4.6.2 (at the time of writing)

  • .NET Core 1.0

  • ASP.NET Core 1.0 MVC

  • SignalR 3 (not released at the time of writing)

Putting it all together

Now that you're familiar with the moving parts of ASP.NET Core and its various version numbers, how will you decide which parts to use? The good news is that you won't have to figure it all out before you get started on your project.

Think about the requirements of your web software project and the needs of your customers. Choose the technologies that make sense for you and your team, and get started on a Minimum Viable Product (MVP).

If you need to support web browsers, go with ASP.NET MVC and build responsive web applications that look good on any screen size. If you need to extend your application with Web API, expose only what needs to be exposed.

If you need real-time functionality, SignalR is a great place to start. At the time of writing, Microsoft has announced that SignalR 3 will not be included with the 1.0 release of ASP.NET Core. As a result of this, SignalR 3 will not be covered in this book. For more information, stay tuned to the SignalR website:  http://www.asp.net/signalr .