In order to use Entity Framework Core 5, you will need some tools. These tools include Visual Studio (VS) 2019 and some NuGet packages for your solution.
Install Visual Studio
The first step is getting a version of Visual Studio 2019. The Community Edition of Visual Studio 2019 for Windows can be used for all code in this book. If you are running macOS, you can also opt to install Visual Studio for Mac. I’ll be using Windows for the remainder of the book, but the steps are about the same for macOS.
Entity Framework Core 5 will run on both .NET Core 3.1 and .NET 5. For this book, we will be using .NET Core 3.1.
Create a Project
Entity Framework Core 5 works on a variety of application types from console apps, desktop apps, and web apps. For this book, we will be creating an ASP.NET Core MVC (Model-View-Controller) app.
Then click the “Create” button to create the project and solution. After this, you will see the generated project opened in Visual Studio.
Install Entity Framework
Entity Framework Core 5 has providers for Microsoft SQL Server, SQLite, Cosmos, and in-memory databases. For this book, we will be using the SQL Server provider.
Entity Framework is installed through the NuGet Package Manager. We will be installing the Entity Framework Core 5 SQL Server NuGet package, which will allow us to interact with a Microsoft SQL Server instance.
Click the I Accept button, and the package will be installed.
Install the Core Tools Package
You have now successfully installed the needed tools to use Entity Framework Core 5. In the next chapter, we will cover how to move the Entity Framework 5 NuGet installation to a data access layer (DAL) project and how to structure your application using an N-tier architecture. You are well on your way to learning how to effectively use Entity Framework Core 5.
SQL Server Database
For this book, we will be using SQL Server Express LocalDb that is installed automatically by Visual Studio 2019 Preview as part of the .NET Core workload. Feel free to use your own full SQL Server instance. I will cover how to set the database connection string and create the database from code in Chapter 5.
Summary
In this chapter, you’ve installed the tools needed to use Entity Framework Core 5 with a Microsoft SQL Server instance. You’ve installed the latest Visual Studio 2019 and Entity Framework Core 5 into our solution.
With this groundwork lain, we can move on to structuring our application in the next chapter to effectively use Entity Framework Core 5. A good architecture goes a long way in allowing the application to be easily tested through unit and integration tests and eases maintenance of the application over time.