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 Query
- Linq SQL error with one-to-many relationship and orderby complex expression
- OrderBy with Dynamic Linq and one to many relationship in EF
- query and create objects with a one to many relationship using LINQ
- LINQ to SQL - Compile error when extending data context with partial class and methods
- How to Select All with a One to Many Relationship Using Linq
- One to one relationship in Sql Server and LINQ
- Many to Many relationship using SQL and Linq (entity framework/to entities)
- Linq to sql - Join 2 tables, select 1 row from right table with a 1 to many relationship
- entity framework with linq query and stored expression error
- Paging API calls using Linq to Sql OrderBy with string parameter and reflection
- Join two tables with one to many relationship and pick latest from multiple side
- C# LINQ to SQL - one to many relationship
- how to write a Linq query with a EF code first Many to Many relationship
- How to write a LINQ query or Lambda expression on one to many relation with filter
- Joining or Including multiple tables with Entity Framework Core LINQ to Entities - One to Many and then Many to One
- MVC C# binding a linq to sql object with a one to many relation for the edit page
- How to write SQL and LINQ to get the one record from a result with where condition?
- LINQ OrderBy with more than one field and also with multiple conditions
- Linq and Lambda expression for a complex sql query involving joins
- Implementing LINQ to Entity on many to one and one to many relationship
- Entity Linq - Retrieve record and only the first child record in a one to many relationship
- using linq query with include/then_include vs using sql query with joins and gettng db server error
- Linq expression with Join, and conditional OrderBy / OrderByDescending
- Creating Linq from SQL with OrderBy and GroupBy
- Linq to Sql One to many relationship string.join
- Linq and EF: Querying to get results on one to many relationships: Selecting table with foreign Key
- How to write SQL translateable linq code that groups by one property and returns distinct list
- Having trouble to write lambda expression for One to Many Relationship in Linq
- How to convert SQL query to LINQ lambda expression with Inner Join and subquery
- Linq to SQL one to many to many relationship join
More Query from same tag
- Using LINQ to find a common prefix?
- Parsing xml data using Linq to Xml
- The property 'x' on 'tblX' could not be set to a 'null' value. You must set this property to a non-null value of type 'Int16'
- Creating an asynchronous method that contains a linq query
- Mapping List not getting all items from master list
- reading data from multiple excel sheets with linq to excel (http://code.google.com/p/linqtoexcel/)
- Why can LINQ operations be faster than a normal loop?
- Linq optimisation within a foreach
- MVC4 lambda expression for SimpleMembership
- How do I return the ancestors of an object with LINQ?
- LINQ Query - Dynamic PIvot on Date
- Selecting documents between user-specified dates using linq with mongodb
- what is the best way to structure this query
- Sequence contains no elements - no info in stack trace
- Getting Unique Combinations Of Particular Table?
- Need help creating Linq.Expression to Enumerable.GroupBy
- Multiple References of an entities in Entity Framework
- SPFieldLookupValue in Linq Query
- No property or field 'OrderID' exists in type 'XElement' (at index 0)
- Getting list of child entity nested several levels with LINQ
- LINQ, Getting the next and previous record in my table (I'm Confused)
- Max, SelectMany, with possible no responses
- Calculating Average with Linq
- Linq Contains in one query
- Slow In-Memory Collection with ~500 requests/second
- Sorting objects by selected property in LINQ
- Entity Framework - Group and Min
- Is there a better way to set a property common to a list of items in linq
- How to sum result in each Table and Round from RoundResult in HomePayerResult
- Linq group objects by unique values and make two lists