Book Image

ASP.NET Core 2 Fundamentals

By : Onur Gumus, Mugilan T. S. Ragupathi
Book Image

ASP.NET Core 2 Fundamentals

By: Onur Gumus, Mugilan T. S. Ragupathi

Overview of this book

The book sets the stage with an introduction to web applications and helps you build an understanding of the tried-and-true MVC architecture. You learn all about views, from what is the Razor view engine to tagging helpers. You gain insight into what models are, how to bind them, and how to migrate database using the correct model. As you get comfortable with the world of ASP.NET, you learn about validation and routing. You also learn the advanced concepts, such as designing Rest Buy (a RESTful shopping cart application), creating entities for it, and creating EF context and migrations. By the time you are done reading the book, you will be able to optimally use ASP.NET to develop, unit test, and deploy applications like a pro.
Table of Contents (14 chapters)

Installing the ASP.NET Core NuGet Package in Your Application


We'll straight away jump to installing the ASP.NET Core NuGet package in your application.

Follow these steps to install the NuGet package of ASP.NET MVC:

  1. Right-click on the dependencies, and select the Manage NuGet Packages option:
  1. We will see that a package called Microsoft.ASPNetCore.All is installed (as shown in the following screenshot). This package is actually a meta package that installs most of the dependencies we need.
  1. If we extend this package from dependencies, we will see:

So, everything we need is already installed regardless of using an empty project or not.

ASP.NET Core is installed in our application. Now, we need to tell our application to use ASP.NET MVC.

This needs a couple of changes to the Startup.cs file:

  1. Configure the application to add the MVC service. This can be done by adding the following line to the ConfigureServices method of the Startup class:

Note

Go to https://goo.gl/RPXUaw to access the code.

public void...