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

Expression Tree Tutorial - Knowledge Base (KB)

252 results in tag: linq

Using a Linq Expression tree, find an event.

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

In.NET 3.5 expression trees, assignment

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

What is the best way to create a Linq Expression Tree that compares to 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

Within a generic extension method, how do I apply OrderBy to an IQueryable using a string column name?

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

I'm not sure how to make an expression tree using IEnumerableTSource>. 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

In C#, how can I build an Expression Tree by parsing XML?

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

In Expression Trees, what is the best technique to invoke an instance method?

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

Expression. Alternatively, the argument 'item' is out of 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

How do you feed bits of a LINQ query into a function in LINQ to SQL?

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

To pick an anonymous type, establish a LINQ Expression Tree.

I would like to generate the following select statement dynamically using expression trees:...var v = from c in Countries where c.City == "London" select new {c.Name, c.Population}; ...I have worked out how to generate...var v = from c in ...
c# entity-framework expression-trees linq linq-to-entities
asked by Tom Deloford

Dummies' expression trees?

I am the dummy in this scenario....I've tried to read on Google what these are but I just don't get it. Can someone give me a simple explanation of what they are and why they're useful?...edit: I'm talking about the LINQ feature in .Net.
.net c# expression-trees linq
asked by Dave

Property name retrieved from lambda expression

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

How may the type of a parameter in an expression be changed?

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...
.net c#-3.0 expression-trees lambda linq
asked by Oscar Cabrero

Partially executing an IQueryable query while leaving the remainder to Linq for Objects

I have a Linq provider that sucessfully goes and gets data from my chosen datasource, but what I would like to do now that I have my filtered resultset, is allow Linq to Objects to process the rest of the Expression tree (for things like Joins, projection...
c# expression-trees iqueryable linq
asked by Tim Jarvis

Linq Expression Tree Hierarchy may be printed.

The ...dynamic language runtime (DLR)... has some pretty cool code for Expression's, including some very nice code to print out Expression trees which I want to use so that:...int a = 1; int b = 2; Expression<Func<int, int>> expression = (c) => a + (b * ...
dynamic-language-runtime expression-trees linq string
asked by anon

Is there a simple method to convert a string (lambda expression) into an Action delegate?

I have a method that alters an "Account" object based on the action delegate passed into it:...public static void AlterAccount(string AccountID, Action<Account> AccountAction) { Account someAccount = accountRepository.GetAccount(AccountID); AccountAct...
.net c# expression-trees linq parsing
asked by Whisk

How can I build an ExpressionFuncMyClass, bool>> predicate dynamically?

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

Programmatically convert SQL Query to Linq Expression.

Is it possible to somehow programmatically convert a sql query to a linq expression tree? The sql query is supposed to be generated by this linq query, so I'm thinking of it as a poor man's serialization\deserialization of linq queries to t-sql format....
expression-trees linq linq-to-sql
asked by Valentin Vasilyev

How do I call a method using a LINQ expression?

I've been playing around with the ...DLR... a bit and am a bit stuck on calling methods. For example, suppose I want to make an expression to push something onto a stack:...class StackInfo{ protected Stack<SomeClass> _stack; public Expression P...
c# dynamic-language-runtime expression-trees linq
asked by Jason Baker

How do linq expression trees acquire the value of a parameter?

AddOptional<tblObject>(x =>x.Title, objectToSend.SupplementaryData); private static void AddOptional<TType>(Expression<Func<TType,string>> expr, Dictionary<string, string> dictionary) { string propertyName; string propertyValue; Expression e...
c# expression-trees lambda linq
asked by Tadeusz Wójcik

Page 1 of 13
  • 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...
Get monthly updates by subscribing to our newsletter!
SUBSCRIBE!