zzz projects Expression Tree Tutorial
Getting Started Documentation Knowledge Base
  • Getting Started
  • Documentation
  • Knowledge Base

Expression Tree Tutorial - Knowledge Base (KB)

656 results for:

Identify an event via a Linq Expression tree

The compiler usually chokes when an event doesn't appear beside a ...+=... or a ...-=..., so I'm not sure if this is possible....I want to be able to identify an event by using an Expression tree, so I can create an event watcher for a test. The syntax wo...
c# expression-trees linq
asked by user1228

Try-catch every line of code without individual try-catch blocks

I do not currently have this issue..., but you never know, and thought experiments are always fun....Ignoring the obvious problems that you would have to have with your architecture to even be attempting this..., let's assume that you had some horribly-wr...
c# expression-trees try-catch
asked by tags2k

Advice on C# Expression Trees

I'm working on a method that accepts an expression tree as a parameter, along with a type (or instance) of a class....The basic idea is that this method will add certain things to a collection that will be used for validation....public interface ITestInte...
c# expression-trees reflection
asked by Ian P

Assignment in .NET 3.5 expression trees

Is it possible to encode an assignment into an expression tree?
expression-trees linq
asked by Eric Smith

Serializing and Deserializing Expression Trees in C#

Is there a way to Deserialize Expressions in C#, I would like to store Expressions in a Database and load them at run time.
c# expression-trees serialization
asked by Alexandre Brisebois

How do I build a Linq Expression Tree that compares against a generic object?

I have an IQueryable and an object of type T....I want to do IQueryable().Where(o => o.GetProperty(fieldName) == objectOfTypeT.GetProperty(fieldName))...so ......public IQueryable<T> DoWork<T>(string fieldName) where T : EntityObject { ... T...
c# entity-framework expression-trees generics linq
asked by JTew

Lambda Expression Tree Parsing

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...
c# expression-trees lambda
asked by Keith Fitzgerald

Given a type ExpressionType.MemberAccess, how do i get the field value?

I am parsing an Expression Tree. Given a NodeType of ExpressionType.MemberAccess, how do I get the value of that Field? ...From C# MSDN docs: MemberAccess is A node that represents reading from a field or property. ...A code snippet would be incredibly, ...
c# expression-trees reflection
asked by Keith Fitzgerald

How do I create an expression tree to represent 'String.Contains("term")' in C#?

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...
.net c# expression-trees lambda
asked by flesh

How do I apply OrderBy on an IQueryable using a string column name within a generic extension method?

public static IQueryable<TResult> ApplySortFilter<T, TResult>(this IQueryable<T> query, string columnName) where T : EntityObject { var param = Expression.Parameter(typeof(T), "o"); var body = Expression.PropertyOrField(param,columnName); var sor...
.net c# entity-framework expression-trees linq
asked by JTew

How do I set a field value in an C# Expression tree?

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...
c# expression-trees lambda
asked by TheSoftwareJedi

How do I create an expression tree calling IEnumerable<TSource>.Any(...)?

I am trying to create an expression tree that represents the following:...myObject.childObjectCollection.Any(i => i.Name == "name"); ...Shortened for clarity, I have the following:...//'myObject.childObjectCollection' is represented here by 'propertyExp' ...
.net c# expression-trees linq
asked by flesh

How do I Create an Expression Tree by Parsing Xml in C#?

I am looking to create an expression tree by parsing xml using C#. The xml would be like the following:...<Expression> <If> <Condition> <GreaterThan> <X> <Y> </GreaterThan> </Condition> <Expression /> <If> <Else> <Expression />...
.net c# expression-trees linq xml
asked by SharePoint Newbie

Best way to call an instance method in Expression Trees?

What is the best way to call an instance method within an Expression Tree? My current solution is something like this for an interface method "object GetRowValue(rowIndex)" of the interface IColumn....public static Expression CreateGetRowValueExpression( ...
c# expression-trees linq
asked by Rauhotz

Practical use of expression trees

Expression trees are a nice feature, but what are its practical uses? Can they be used for some sort of code generation or metaprogramming or some such?
c# expression-trees
asked by Dmitri Nesteruk

Expression.Or, The parameter 'item' is not in scope

I am trying to write a static function to Or two expressions, but recieve the following error:...The parameter 'item' is not in scope....Description: An unhandled exception occurred during the execution of the current web request. Please review the ...
c# expression expression-trees linq
asked by ccook

In LINQ to SQL, how do you pass parts of a LINQ query into a function

Is it possible to pass parts of a linq Query into a function? I want create a common interface for my DAL that always uses the same query interface. For example, ...List<T> Get(Join j, Where w, Select s){ return currentDataContext<T>.Join(j).Wh...
c# expression-trees linq linq-to-sql
asked by Arron S

C# LINQ Where Predicate Type Arguments

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...
c# entity-framework expression-trees lambda
asked by blu

how to create expression tree / lambda for a deep property from a string

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...
c# expression-trees lambda
asked by Andrew Bullock

C# Expression Tree Parameter for Parent Navigation Property

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...
c# entity-framework expression-trees lambda
asked by blu

Page 1 of 33
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • …
  • »
  • »»

Prime Library

Performance

  • Entity Framework Extensions
  • Entity Framework Classic
  • Bulk Operations
  • Dapper Plus

Expression Evaluator

  • C# Eval Expression
  • SQL Eval Function
More Projects...