it is possible to change expression trees at runtime (by building a new one out of the existing one), since o/rm tools such as linq to sql and entity framework do this constantly, but it's not really easy. it has become easier with the introduction of the
expressionvisitor class of .net 4.0, but still don't expect it to be simple.
here is an article that shows an example of this.
would it help to convert the query to an enumerable and call count() on this like this:
var num = query.asenumerable().count();
this would execute the query and afterwards makes a simple count() on the result instead of letting the count() flow into the expressiontree.
- LINQ - Remove Parts of Expression Tree
- Selectively remove from where clause in LINQ expression tree
- How to move parts of a LINQ query to an reusable LINQ expression tree
- How to create LINQ Expression Tree to select an anonymous type
- How do I create a Linq expression tree with an F# lambda?
- Print out Linq Expression Tree Hierarchy
- How to build a dynamic AND OR linq expression tree in a loop
- Identify an event via a Linq Expression tree
- Dynamic linq query expression tree for sql IN clause using Entity framework
- How to reuse a linq expression for 'Where' when using multiple source tables
- refactoring LINQ IQueryable expression to remove duplicated portions of queries
- LINQ Expression Tree Any() inside Where()
- How to re-wrap a Linq Expression Tree
- LINQ Source Code Available
- Build expression tree for LINQ using List<T>.Contains method
- what is the Linq expression tree for setting a property of an object?
- LINQ to Entities OrderBy Expression Tree
- Creating a tree with LINQ expression
- how to create a pivot table with dynamic column using linq tree expression
- Unable to get double.TryParse to work in Linq Expression Tree
- How do I build a Linq Expression Tree that compares against a generic object?
- An expression tree may not contain a call or invocation that uses option arguments in C# Linq
- Lambda or LinQ expression to remove certain objects from List
- Dynamic linq expression tree with nested properties
- How to evaluate a standalone boolean expression in a LINQ expression tree
- creating Linq to sqlite dbml from DbLinq source code
- Creating dynamic linq expression tree against nested OData
- Linq to Sql: Optimizing lamba expression - clean code
- Linq expression tree string comparison
- Automatically add some Where clauses to a Linq Expression Tree
More Query from same tag
- Efficient way of updating a collection from another collection
- Join Tables in Linq using lambda expression
- Search IList of KeyValuePairs for two keys
- Combining database cells in column B for matching cells in column A in VB.NET
- Convert linq query to lambda expression
- LINQ to SQL in and not in
- Is there a way to speed up the contains extension in a LINQ query for large datasets?
- Dynamics 365 OrganizationServiceContext Linq Query with multiple Joins
- Find all possible sequence list from single list c#
- Check if two lists are equal
- Filtering data with Expression Func - C# - How to apply filter on referent table?
- Reseed SQL server statement throwing error Incorrect Syntax near
- Compare two generic lists using Linq
- Sort list of different models by two fields with different type
- linq Custom ordering without taking all records
- Convert a list<int> to a joined string of ints?
- Unable to create a constant value. Only primitive types
- Error inside web service in Linq query I guess
- Creating dynamically linq to EF query with OR predicates
- How to sort datatable with multi column using LINQ
- How to return rows in LINQ and MVC ,
- How to check list A contains any value from list B?
- .AsExpandable in Linq to Entity
- Check if enumeration contains multiple elements without throwing exception?
- Where clause in Linq in List c#
- Using "contains" to query a list <Key-Value> in C#
- Difference between the LINQ join and sub from
- GroupBy columns of DataTable and calculate sum of string column
- Dynamic comparison with ef based on a property string name
- NDepend Linq mixing the output of one query with another