score:3
Accepted answer
You can join all the tables:
from t3 in Table3
join t2 in Table2 on t3.Table2_FK equals t2.ID
join t1 in Table1 on T2.Table1_FK equals t1.ID
where t2.property == "some value" && t1.property == "some other value"
select t1;
(edit)
I doesn't go just one level deep. In fact, your first example should work. Of course, your relations must be N to 1:
Table3 (n) --- (1) Table2 (n) --- (1) Table1
given t3
of Table3
you can do:
t3.Table2.Table1
Do you have the proper connection between Table2
and Table1
in the .dbml
file?
Source: stackoverflow.com
Related Articles
- Multiple layers of foreign keys in LINQ query
- AP.NET webforms using LINQ to SQL datasource and databind with foreign keys across multiple tables
- Strongly Typing a LINQ Query using multiple keys of complex objects
- Building a Linq Query for multiple Foreign tables
- Using navigation properties in linq query throws error if foreign keys are null
- LINQ query : Get all fields including Foreign keys
- Multiple Null Foreign keys group join error in Linq
- How to Update multiple tables with foreign keys using LINQ expression ASP.NET MVC Entity Framework
- Entity framework linq query Include() multiple children entities
- Can I select multiple objects in a Linq query
- How to apply multiple orderby in linq query
- Selecting multiple columns with linq query and lambda expression
- LINQ query to perform a projection, skipping or wrapping exceptions where source throws on IEnumerable.GetNext()
- Linq query with multiple Contains/Any for RavenDB
- LINQ left outer join query error: OuterApply did not have the appropriate keys
- linq to sql query with multiple where parameters
- Deleting multiple records with Entity Framework using a single LINQ query
- Does this LINQ code perform multiple lookups on the original data?
- LINQ query to match multiple words
- LINQ query with a WHERE clause with multiple conditions
- LINQ to SQL: Complicated query with aggregate data for a report from multiple tables for an ordering system
- Linq query join one table row to another table multiple row
- Multiple on clause in LINQ to DataTable Join Query
- Is there any way to create a LINQ query as a variable without having the data source (yet)?
- C# multiple variables in lambda expression inside LinQ query
- Multiple foreign keys to the same table
- Linq query with multiple OrderBy statements added in a loop
- LinQ query with multiple tables and extracting data
- How to reuse a linq expression for 'Where' when using multiple source tables
- LINQ Query Returning Multiple Copies Of First Result
- How to get a List of Integers from a Property when another property exists within a List<int>?
- LINQ Query To Join Two Tables and Select Most Recent Records from Table B corresponding to Table A
- How to check if a list of object contains an object with a specified properties
- Why does my code not find directories
- How to compare decimal DBNull in Linq?
- LINQ to XML for a small appliction can it replace a small database?
- Map 2 arrays to list of objects with each array as a property
- How to send in "NULL/DbNull" into a table-column with the datatype: nullable int
- LINQ Group By on DateTime
- TSQL - Select from table with multiple join paths
- Linq except two IEnumerable queries
- LINQ group by sum of property
- OrderBy with a non-transitive IComparer
- Group By and To Dictionary in EF Core 3.1
- comparison goes faulty c# Dictionary<String, string[]>
- Querying sub document Ravendb
- C# SQL To Linq - Where Clause with multiple variables Comparison (var1+var2) !=(var1+var2)
- How can I simultaneously group and sum a list of items using Linq?
- Selecting multiple values from XML XDocument (VB.NET)
- How can I simplify (speed up) the selecting query from a database that contains more than 1 million records using LINQ