score:2
The reason you can't call Take(200) before calling OrderBy is that Take(200) forces the NHibernate LINQ provider to evaluate the linq query. Once the query has been evaluated, it cannot add further SQL clauses to the mix without re-evaluating the query, something that might have unintended consequences.
score:2
There is no restriction on what order they can be called in. It's perfectly valid to call Take(200)
followed by OrderBy
in LINQ. LINQ is nothing more than a series of methods; it doesn't describe how those methods are actually implemented. Some of the actual implementations include Linq-to-objects (a bit of a special case), LINQ-To-SQL, Entity Framework, and then any number of other query providers based on the IQueryable
LINQ methods.
Some particular providers may only support a subset of the LINQ methods, or may not support some other aspect that LINQ can describe. In those cases they may error out (or do some other undesirable behavior). You will need to look into the documentation of whatever specific LINQ provider you are using to see what it does and does not support.
Source: stackoverflow.com
Related Query
- Is there an overview for Nhibernate in which order you must use extension methods?
- Is there a way to specify which extension method to use for extension methods of the same name in different namespaces?
- Can you use LINQ types and extension methods in IronPython?
- In which cases do I need to create two different extension methods for IEnumerable and IQueryable?
- Is there way to use extension methods to achieve below implementation in C#?
- Is there a plugin for visual studio 2008 that will allow you to use Linq in a watch window?
- What is the most efficient way or best practice for null check when you use Split and FirstOrDefault methods together?
- How do you perform a left outer join using linq extension methods
- Extension methods must be defined in a non-generic static class
- Order of LINQ extension methods does not affect performance?
- How to: Use async methods with LINQ custom extension method
- Is there a good source that gives an overview of linq optimizations?
- LINQ to SQL - Why can't you use a WHERE after an ORDER BY?
- Is there any way to use an extension method in an object initializer block in C#
- Is there any way to use LINQ for MDX queries?
- How to write extension methods for anonymous types?
- LINQ extension methods not available for EnumerableRowCollection<TRow>
- What is the C# extension methods equivalent for this Linq query?
- Would you abstract your LINQ queries into extension methods
- Is there any extension method which get void returning lambda expression ?
- linq - how do you do a query for items in one query source that are not in another one?
- Which methods use in Linq to force a retrieving data from database
- Extension methods equivalents for CAR and CDR in .Net's Linq/IEnumerable
- Is there any open source software for converting SQL statements to LINQ?
- Extension to choose which extension to use in Linq
- Is there any default order in which where clause in LINQ query filters sequence
- Is there a query generator or extension point for QueryOver like there is for LINQ?
- Can you use LINQ extension method operators in an ASP.NET databinding expression?
- How can i use Extension Methods in boo
- .Cast<T> extension method always throws InvalidCastException - How are you supposed to use this method?
More Query from same tag
- Entity Framework Generic Predicate
- Order of operations when creating new object with .Select()
- best practise/way for master detail / multi table Insert in Entity Framework
- Group names by query
- query when number of conditions is not defined
- Expression Tree for Aggregate Function in LINQ to Entities
- How to map child objects to parent from Linq
- C# LINQ - Split Rows into Two Rows
- How to asynchronously call a database with subrecords using LINQ?
- Left outer join now working linq object reference not set to an instance of an object
- RavenDB Lucene Query equivalent of Linq Contains
- New dictionary using LINQ to dictionary
- Remove an XElement from another XDocument
- linq with dataTable in c#
- Static C# variable, throw an error because of a database connection
- LINQ where to Match exact string
- Get records from related entity
- Group Joins with multiple tables converting SQL to Linq
- Compare 2 DataTables and Select Rows Not in 2nd table Using 2 Criteria
- Listview, remove duplicates using LINQ and based in subitem comparing
- pass a linq query with group by to view [errors out]
- Filter a list based on a multiple options
- The Property method can only be used with primitive or complex properties. Use the Reference or Collection method
- Error Cannot implicitly convert type 'string' to 'int' - for the iterator in a ForEach loop
- LINQ / XML - Storing child nodes which have different names in a custom class
- Grouping using multiple columns, then summing a specific column using method syntax
- LINQ expression node type is not supported in LINQ to Entities
- Is LINQ always preferred before sorting in an SQL-statement?
- Return array from Linq SQL query on 80 million row table using EFCore
- Object grouping with linq or lambda expression