score:0
Accepted answer
I couldn't get around this issue in a single linq statement. My work-around for now is to run the query without my order by clauses and output a List. Then in a second statement, apply the order by clauses to that list.
var dogs = _context.Dogs.Include(d => d.Fleas).ToList();
dogs = dogs.OrderBy(d => d.groomerId.HasValue).ToList();
Source: stackoverflow.com
Related Articles
- Linq SQL error with one-to-many relationship and orderby complex expression
- how to write a Linq query with a EF code first Many to Many relationship
- OrderBy with Dynamic Linq and one to many relationship in EF
- How to Select All with a One to Many Relationship Using Linq
- JIT error with LINQ OrderBy using C# on iOS
- Linq Expression for Paging / Pagination with dynamic OrderBy
- query and create objects with a one to many relationship using LINQ
- Expression for OrderBy linq with inner expression
- Linq Expression for matching a complex many-to-many relationship
- Linq orderby for complex expression in select
- Linq to sql - Join 2 tables, select 1 row from right table with a 1 to many relationship
- Linq in conjunction with custom generic extension method build error - An expression tree may not contain an assignment operator?
- entity framework with linq query and stored expression error
- Error LINQ expression contains references to queries that are associated with different contexts
- LINQ Aggregate results with Many to Many Relationship
- The specified LINQ expression contains references to queries that are associated with different contexts error in c#
- Dynamic Linq - Joining a table with 1 to many relationship
- Joining on a many to many relationship with LINQ
- Write Complex Linq Join with Lambda Expression
- linq query with many to many relationship
- Compiling Error with LINQ Sorting Code Using List<T>
- Linq OrderBy with an expression variable
- linq null reference error with orderby but firstordefault works
- How can I join a many to many relationship with linq
- How to write a LINQ query or Lambda expression on one to many relation with filter
- Linq Lambda Error : The specified LINQ expression contains references to queries that are associated with different contexts
- Dynamic Linq Where with Lambda Expression generates Error
- Trouble with a LINQ 'filter' code throwing an error
- In a many to many relationship , how to retrieve the values like 2-D array with help of linq
- EF code first: using Linq with many-to-many relationship
- How can I take a list of dates, and remove any that are within 1 minute of another date in the list with LINQ?
- Query for all nested XML types in LINQ
- LINQ to XML aggregates and group by
- Select Method find one below and one above using Linq
- Deleting records in LINQ with foreign keys - invalid cast exception
- Avoiding the 2100 rpc limit with LINQ Select and Lambda
- subquery Problem in Linq To Nhibernate
- Dynamically Building LINQ-To-Entities Where Clause
- Using Lambda / Linq Filter Parent Collection based on Child Items
- Linq to create a csv string for some values stored in an array of object using c#
- Can't get c# linq query to compile with joins
- LINQ Summary of Nested Dictionary
- Converting a LINQ query into a Dictionary<string, string[]>
- C# Joining List<of type> and handling NULL/Empty values
- C# Dynamic Projection of all properties into one object
- How to get all parents with a specific child value in asp.net mvc using LINQ?
- how to use group by function for DbFunctions.DiffMinutes
- How can I include a linq expression to screen a list of generic items
- distinct list LINQ Query
- Using LINQ to obtain dependencies of tasks stored in a table