All Questions
24 questions
0
votes
1
answer
49
views
Extract a strongly typed expression from a function expression body
I'm trying to write a "relaxed" comparison method which operates on Expressions and is used in Entity Framework. It consists of a chain of Replace() calls and ToLower() to perform an inexact ...
2
votes
1
answer
91
views
How add MemberInitExpression into Bindings other Lambda MemberInitExpression
I have the following classes:
class Source {
public int Id { get; set; }
public string Name { get; set; }
public SourceItem Item { get; set; }
}
class SourceItem {
public Guid Id { ...
0
votes
0
answers
67
views
Using C# Expressions to build Array.All for Entity Framework
I'm building a SQL "WHERE" clause dynamically using the System.Linq.Expressions.Expression class.
There are two tables
Report and Document with relation one to many
public class Report
{
...
0
votes
1
answer
337
views
Building Expression to search in child properies (collection) of object
I have a search setup to return matching Record objects based on criteria. It builds an Expression Tree based on the type of criteria and queries the database to return matches. Previously, it only ...
1
vote
1
answer
1k
views
How to create dynamic LINQ Expression with multiple binary expression conditions and a contains condition
I want to create a dynamic LINQ Expression for this kind of query
people.Where(x => x.Name="Some_Name" && x.Age>60 && x.ChildIds.Contains("Some_Id"));
What I ...
0
votes
1
answer
1k
views
Dynamically generate LINQ select with nested collection properties
The question is very similar to Dynamically generate LINQ select with nested properties
public static Expression<Func<TSource, TTarget>> BuildSelector<TSource, TTarget>(string ...
0
votes
1
answer
1k
views
The LINQ expression could not be translated!? why?
I'm trying to retrieve a few records from a table given a certain condition... this is my code:
var areas = _context.Set<T>()
.Where(p => (int)p.GetType().GetProperty(...
0
votes
1
answer
50
views
Can't create a condition for null values in an array?
I am using linq expression trees to build a query.
My array:
string[] { null, null }
condition I want to implement:
x == null ? null : x.ToLower()
My linq expression looks like this:
{Param_0 =>...
1
vote
0
answers
74
views
How do I help the JIT to prevent interface dispatches in Expression.Lambdas?
I'm in a situation where I have to work with linq expressions and I need to get the last bit of performance out of them.
After much work, and implementing all the lower hanging fruit, I've reached a ...
2
votes
1
answer
3k
views
Expression parameter is not defined
I am trying to perform a query against a list to give immediate results using an expression that is set elsewhere in the code, while a second thread goes off and uses it to get a full set of results ...
1
vote
1
answer
2k
views
Linq Expressions. Equivalent of greater than for strings
I have followed several threads on SO and other websites and am still having difficulty.
I have the following code:
public static IQueryable<TSource> Between<TSource, TKey>(this ...
5
votes
2
answers
2k
views
Trying to use parent property as parameter in child collection expression; LinqKit throws "Unable to cast MethodCallExpressionN to LambdaExpression"
I'm trying to dynamically construct an expression similar to the one below, where I can use the same comparison function, but where the values being compared can be passed in, since the value is ...
6
votes
1
answer
3k
views
Merge two linq expressions
I have two expressions that are built out at separate times, but need to be merged in order to get an accurate 'grouping' of a where clause. I did try this option, but I am using Entity Framework and ...
3
votes
2
answers
753
views
How to access argument properties when writing custom NHibernate HQL generator
I have the following custom type with a method on it to determine if one span of time overlaps another
public struct DateTimeSpan
{
public DateTime? Start { get; set; }
public DateTime? End { ...
1
vote
1
answer
2k
views
How to combine result of multiple Linq Expressions into one Expression?
I have a list of Linq Expressions List<Expression> where each expression type (the type the expression would return) is either Item or Item[].
I'm trying to write some code that would take ...