Using LINQ with EF Core
To learn about projection, it is best to have some more complex sequences to work with, so in the next project, we will use the Northwind
sample database.
Building an EF Core model
Let's define an Entity Framework (EF) Core model to represent the database and tables that we will work with. We will define the entity classes manually to take complete control and to prevent a relationship from being automatically defined. Later, you will use LINQ to join the two entity sets.
- Create a new console application project named
LinqWithEFCore
, add it to the workspace for this chapter, and select the project as active for OmniSharp. - Modify the
LinqWithEFCore.csproj
file, as shown highlighted in the following markup:<Project Sdk="Microsoft.NET.Sdk"> <PropertyGroup> <OutputType>Exe</OutputType> <TargetFramework>net5.0</TargetFramework> </PropertyGroup> <ItemGroup...