Project Description
Expression Tree Library is a generic library to help end developers build up dynamic expression tree's to be used in .Net's Entity Framework, Linq, or in .Net

Why I Built This Library
My last project at work required us to use expression tree's. I struggled at first with the lack of information on the web. I want to share my experiences and help other developers with expression trees.

Some Scenario's Where This Comes In Handy
1. Ever have to build up the following lambda for Entity Framework or Linq in .NET and you have to do it for 50 fields? Well use this library to build up the lambda at run time then run an Entity Framework or Linq query off of it.

context.Where(x => x."Some Dynamic Property" >= 4).ToArray()


2. Ever have 2 Func<T,bool> and you want combine them in a "And" / "Or" statement?
//Linq
var myNewExpression = Func1 && Func2
or 
var myNewExpression = Func1 || Func2


3. Every have a projection and you want to modify it?
//let's build up my select statement
//it will take Ref_Table and return MyNewObject
Expression<Func<Ref_Table, MyNewObject> mySelectExpression = x => new 
{
 Id = x.Id
};

//now i can modify that expression dynamically
if (some variable == true)
{
   mySelectExpression = mySelectExpression.Merge(x => new 
        {
             Txt = x.Txt
        }
}

//now go query the data (in either EF or Linq)
var myData = context.Ref_Table.Where(x => x.id > 5).Select(mySelectExpression).ToArray()


4. If you have any custom scenario I can build it onto the library. Just let me know

See the documentation tab for extensive documentation

Last edited Aug 31, 2014 at 2:29 PM by Torac24, version 13