score:1
it's not that the icomparer is not supported, it is that in linq-to-sql, an orderby() must be translated to a t-sql operation. if it allows you to specify criteria for comparisons, the c# code behind it would have to be executed by sql server to use it.
if you need to do something in linq-to-sql that is not supported but which can be done in t-sql, you can always get around it by using a stored procedure, which work splendidly with linq-to-sql. if that it inconvenient, you can call the tolist() method to invoke the execution and then sort it in memory. the practicality of this depends on the size of the data and how much of it you wished to fetch (such as when implementing pagination).
score:1
yes. linq-to-sql translates your lambda expressions directly into sql, so it obviously cannot handle arbitrary code. you could use tolist()
to force query execution, and then perform your orderby
on that list.
Source: stackoverflow.com
Related Query
- Can I use C# string interpolation with Linq to SQL
- How can I switch that code to use LINQ
- Can I use the orderby linq keyword with a comparer?
- Can you use LINQ with in memory objects rather than SQL Server queries to improve performance?
- Can I use LINQ to do a join on an IQueryable from SQL Server?
- Can I use a LINQ IEnumerable result as the data source for a Gtk.TreeView?
- How can i use Linq / Linq to Sql to do this?
- Can I Use The Same Linq Code to Query for Different Conditions?
- How can I use two different databases with Linq to SQL in Linqpad?
- Mapping POCO to string in Linq to Sql so that I can use Linq on my POCO
- Does Linq in Entity Framework code first use SQL or does it get the whole table first?
- how to translate a linq expression into sql string use c# code
- How can I use external method in LINQ OrderBy
- What can I do to resolve a "Row not found or changed" Exception in LINQ to SQL on a SQL Server Compact Edition Database?
- Instantiate empty IQueryable for use with Linq to sql
- How can I use Linq in a T4 template?
- How are people unit testing code that uses Linq to SQL
- Can I declare / use some variable in LINQ? Or can I write following LINQ clearer?
- Use own IComparer<T> with Linq OrderBy
- Can you use LINQ types and extension methods in IronPython?
- Can LINQ use binary search when the collection is ordered?
- How can I use linq to sort by multiple fields?
- How can I use LINQ to find a DataGridView row?
- Can I use a TryParse inside Linq Comparable?
- LINQ orderby vs IComparer
- Linq Orderby random ThreadSafe for use in ASP.NET
- How to use distinct with group by in Linq to SQL
- Use contains in LINQ to SQL join
- How can I directly execute SQL queries in linq
- How can I use Linq with a MySql database on Mono?
More Query from same tag
- Remove items from list using their IDs and linq
- Linq - better `Enumerable.Except()` operator (performance AND flexibility)?
- Append List to XML
- How can i use DefaultIfEmpty when mocking a database context?
- Displaying the last word in a sentence in uppercase
- Simple Linq to SQLIte application hangs on SubmitChanges()
- intersection of two list add to another list in mvc
- Group By Users and show DETAILED results for every week day
- How to make nested list operations?
- LINQ statement to find the max amount days using datetime
- Where clause in method syntax fails when combining strings
- The model item passed into the dictionary is of type " something" The model item passed into the dictionary is of type "something else"
- Get only four objects by type and date LINQ
- How to pre-set a variable in a LINQ expression?
- Split results from DB into "chunks" of 10
- Using wildcards with a LinqDataSource
- OrganizationServiceContext.CreateQuery vs Fetch
- Json circular reference and 'Children could not be evaluated' on Linq Include
- Use an extension method in a DynamicLinq-query
- Invoking Generic Method with the parameter of IEnumerable<T>
- Linq outer join query
- Select database entity depending of one of its datetime columns value
- finding last saved id using NHibernate LINQ
- Set EntityCollection in a Linq projection
- Translating SQL results to LINq with join of literal
- LINQ Query to Count Objects by Property Group Between Non Group Objects In Sequence
- How to ignore 'null' in order by clause
- EntityFramework6 - Error 42703: column Extent1... not found
- OrderBy with a non-transitive IComparer
- dilemma on the use of inheritance in EF code-first