I am trying to use Lambda Expressions in a project to map to a third party query API. So, I'm parsing the Expression tree by hand....If I pass in a lambda expression like:...p => p.Title == "title"
...everything works....However, if my lambda expression l...
I am just getting started with expression trees so I hope this makes sense. I am trying to create an expression tree to represent:...t => t.SomeProperty.Contains("stringValue");
...So far I have got:... private static Expression.Lambda<Func<string, boo...
Given:...FieldInfo field = <some valid string field on type T>;
ParameterExpression targetExp = Expression.Parameter(typeof(T), "target");
ParameterExpression valueExp = Expression.Parameter(typeof(string), "value");
...How do I compile a lambda expressio...
I have an XElement with values for mock data. ...I have an expression to query the xml:...Expression<Func<XElement, bool>> simpleXmlFunction =
b => int.Parse(b.Element("FooId").Value) == 12;
...used in:...var simpleXml = xml.Elements("Foo").Where(si...
Given a string: "Person.Address.Postcode" I want to be able to get/set this postcode property on an instance of Person. How can I do this? My idea was to split the string by "." and then iterate over the parts, looking for the property on the previous typ...
How can I create a ParameterExpression for the parent side of a 1 to * Navigation Property?...The following works for the child entity:...var parameter = Expression.Parameter(
typeof(T), // where T is the entity type
GetParameterName()); // helper...
I'm trying to combine the following expressions into a single expression: item => item.sub, sub => sub.key to become item => item.sub.key. I need to do this so I can create an OrderBy method which takes the item selector separately to the key selector. Th...
I have one queryable... where I have used various ...Where... and ...WhereBetween... statements to narrow the collection down to a certain set. Now ...I need to add kind of a ...Where || WhereBetween.... In other words, I can't just chain them together li...
I have used C# expressions before based on lamdas, but I have no experience composing them by hand. Given an ...Expression<Func<SomeType, bool>> originalPredicate..., I want to create an ...Expression<Func<OtherType, bool>> translatedPredicate.......In th...
Is there a better way to get the Property name when passed in via a lambda expression?
Here is what i currently have....eg. ...GetSortingInfo<User>(u => u.UserId);
...It worked by casting it as a memberexpression only when the property was a string. beca...
When I first typed this question, I did so in order to find the duplicate questions, feeling sure that someone must have already asked this question. My plan was to follow those dupe links instead of posting this question. But this question has not been a...
since i am using POCOS in my domain, i want my repository to be able to received Expression filters of the type of my POCOS and change the parameter in the expression to be the of type of my LINQ tables, my fields have the same name as my members so i was...
I understand lambdas and the ...Func... and ...Action... delegates. But expressions stump me. In what circumstances would you use an ...Expression<Func<T>>... rather than a plain old ...Func<T>...?
How would I go about using an Expression Tree to dynamically create a predicate that looks something like......(p.Length== 5) && (p.SomeOtherProperty == "hello")
...So that I can stick the predicate into a lambda expression like so......q.Where(myDynamic...
I've got a bit of a challenge where I have to create an expression tree to represent a query input by the user. Since I don't have the time to create all the possible cases of user input, I figured that expression trees would aid me in solving this....For...
I'm using the standard visitor pattern to iterate through a LINQ expression tree in order to generate dynamic SQL WHERE clauses....My issue is that unlike C#, you can't use a standalone boolean expression in SQL; you have to compare it to either 1 or 0...
Can anybody explain me how to use (1) iQueryable (2) Expression Tree in C# by providing a very basic example? Both are not correlated, instead of making two separate questions, I wish to clear my doubt in a single question....Advanced Thanks.