From the course: .NET Essentials: LINQ for Databases

Unlock the full course today

Join today to access over 22,500 courses taught by industry experts or purchase this course individually.

Use EF navigation properties instead of joins

Use EF navigation properties instead of joins - .NET Tutorial

From the course: .NET Essentials: LINQ for Databases

Start my 1-month free trial

Use EF navigation properties instead of joins

- [Instructor] In SQL, we use JOIN to combine the contents of two tables based on a logical relationship between the tables. There are JOIN query operators available in LINQ, however, because of the way Entity Framework defines relationships between model classes with the navigation properties, we don't need to use JOINs for most Entity Framework queries. So let's take a look at some relationships in our models. I sometimes use the word models and I also use the word table when talking about this but that's because there's a mapping between the two. So I'm looking at a diagram that's in Visual Studio. I'm looking at NorthwindModel.edmx I've added a second diagram here which is a simplified version of the relationships between all the tables and my goal in my query is to query the Order Detail model. I can get UnitPrice and Quantity but I can also get details from the other two tables because of these…

Contents