This tutorial will concentrate on setting up an Entity Framework DbContext class and SQL Server database for an ASP.NET Core Web API.
We'll show you how to install Visual Studio, the .NET SDK and LocalDB onto your machine.
From there, we will create the projects needed in Visual Studio and add the relevant EF Core NuGet packages.
Afterwards, we'll create the DbContext and the database that it's going to connect to and show you how you can check the database connection of a DbContext.
► This is part 1 of our Get started with EF Core course. View the full playlist:
Download the code example
Learn .NET and C# with our online courses
Take our .NET and C# coding challenges
► Connection string needed for the Web API
Server=(localdb)\\MSSQLLocalDB; Database=RoundTheCodeEFCore; Trusted_Connection=true; Trust Server Certificate=true; MultipleActiveResultSets=true; Integrated Security=true;
► Chapters
0:00 What we'll cover
0:13 Setup machine
1:48 Create projects in Visual Studio
3:20 Add Entity Framework NuGet packages
4:13 Create database
5:14 Create DbContext
6:00 Add DbContext to Web API
6:42 Test DbContext connection to the database
7:47 Learn more about EF Core