What package(s) do I need for EF Core 2.x?

First off, it is important to note that there are a couple of ways to download package(s).
1. You can use NuGet right from inside Visual Studio IDE
2. You can also use CLI (Command Line Interface)

Here, I’ll demonstrate both of them.

Even though you could install Microsoft.EntityFrameworkCore, however, you would need a database provider to interact with. Given, that EF Core is modular, and depending on the data-store you want to work with, you would only need to install that specific database provider.

Unlike EF 6.x, where SQL Server is the default database provider; that is not the case with EF Core. EF Core supports a variety of databases that include the following:

  • Microsoft SQL Server
  • SQLite
  • Postgres SQL
  • MySQL
  • SqlServerCompact (By Erik Jensen)
  • In-Memory Testing

When using CLI, you would want to install the following by navigating to Tools – NuGet Package Manager – Package Manager Console.

c:\Install-Package Microsoft.EntityFrameworkCore.SqlServer

If you wish to create a database using Migrations from your POCO classes or what is typically referred as Code-First workflow, you would need to install the following from the command line:

c:\Install-Package Microsoft.EntityFramework.Tools

You might also need Design tools in the event you want to create Controllers and Views using the Scaffolding feature of ASP.NET Core MVC. This can be obtained by installing the following:

c:\Install-Package Microsoft.VisualStudio.Web.CodeGeneration.Design

In the event where you want to use Visual Studio’s IDE, you can simply navigate to Tools – NuGetPackageManager – Manage NuGet Packages for Solution.

Once, the NuGet Window opens up, you can type in the appropriate package in the Search text field which will give you a list of stable packages unless you check the Include Prerelease check box to the right of the search field.

That’s all there is to it!

About Obi Oberoi

I am Technology Aficionado who has a passion for learning, speaking, blogging and hanging out with geeks and like minded people!
This entry was posted in ORM. Bookmark the permalink.