score:5
Accepted answer
//assuming your repo getall() returns a dbquery<t>
var questions = _questionsrepository.getall()
.where(q=>q.subtopic.topic.subjectid = mysubjectid)
.include(q=>q.answers)
.include(q=>q.subtopic.topic)
.tolist();
Source: stackoverflow.com
Related Query
- How can I code a Linq query to do an upward Include?
- How can I write the following code more elegantly using LINQ query syntax?
- How can I check the number of calls to the database in LINQ query when using .NET Core and Code First?
- How can I code numerous MIN functions into one LINQ to DataSet query
- How can I set properties on all items from a linq query with values from another object that is also pulled from a query?
- How can I trace the query produced by the documentdb Linq provider?
- How can I build Linq query with dynamic OR statements?
- How can I convert this SQL Query into LINQ (OVER (PARTITION BY Date))
- How can I view the Entity Framework LINQ query plan cache?
- How can I create a dynamic LINQ query in C# with possible multiple group by clauses?
- How can I switch that code to use LINQ
- How can I combine this code into one or two LINQ queries?
- How can I determine if a LINQ query is going to be LINQ to SQL vs. LINQ to Objects?
- How to use a LINQ query to include index in Select with F#
- How can I tell when a LINQ query is enumerated?
- linq - how do you do a query for items in one query source that are not in another one?
- How can I further simplify this piece of LINQ code
- How can I code an outer join using LINQ and EF6?
- How to dynamic add filters to a LINQ query against an Odata Source in C#
- How can I have a linq query conditionally NOT apply a where clause
- How can I clean up this LINQ Query (SelectMany)?
- How to get SQL query into LINQ form in C# code
- How can I speed up this linq query on a List<> with search criteria on 3 attributes in the list object
- How can I build LINQ query when object type is not known at compile-time
- Using LINQ with MVC, how can I include multiple parameters into a where clause?
- How can I perform a LINQ Query and select?
- How can I implement Query Interception in a LINQ to Entities query? (c#)
- How can I serialize a Linq query to database?
- sub linq query is making this take a very long time, how can I make this faster?
- How I Can use Linq Query count no. of record in query
More Query from same tag
- Method to return records true false or all
- Group by column and get first record of group using Linq
- Inner join with multiple left outer joins
- Using LINQ to get all the records in a table having the same value in a specific column
- Linq group objects by unique values and make two lists
- how to write Query in LINQ For this scenario
- Create same LINQ anonymous type from different XML element
- How can I compare each element of a list with itself only once
- Why does this LINQ grouping have a count of 3 instead of 2?
- Can we use Linq to sort a class based on its ID without implementing IEnumerable
- Find intersecting DataRows in a List of DataTables
- Adding AND in a WHERE clause using ViewBag and SelectList with LINQ in Controller (ASP.Net MVC)
- Check if entity implements interface and add predicate in generic repo
- Cartesian product with grouping
- in foreach loop, should I expect an error since query collection has changed?
- IQueryable LINQ provider and SQL injection?
- Object reference not set to an instance of an object using linq to xml
- Exception in System.Data.Entity.dll but was not handled in user code
- How do I return a LinkedList collection from a lambda?
- LINQ Query to get data from another table
- Getting sub elements using LINQ and XML in C#
- Is there a way to change how Parallel.Foreach interlaces an array that its operating on?
- Need to build a string representation of a folder tree in C#
- Linq correlated subquery to same table on multiple columns
- Distinct of items in dictionary<T,IEnumerable<T>>
- How to convert int to double in a LINQ statement
- Dynamic Linq Query Throwing Property X not member of Class Y
- How can I transform a DataTable in a group-by date DataTable with LINQ?
- Join not working as expected (Entity Framework)
- building median for each string in IList<IDictionary<string, double>>