My understanding of expression tree is :
Expression trees are in-memory representation of expression like arithmetic or boolean expression.The expressions are stored into the parsed tree.so we can easily transalate into any other language.
Linq to SQL
uses expression tree.Normally in LINQ to SQL
query the compiler translates it into parsed expression trees.These are passed to Sql Server as T-SQL Statements.The Sql server executes the T-SQL query and sends down the result back.That is why when you execute LINQ to SQL
you gets IQueryable<T>
not IEnumetrable<T>
.Because IQuerybale
contains
public IQueryable:IEnumerable
{
Type Element {get;}
Expression Expression {get;}
IQueryaleProvider Provider {get;}
}
Questions :
Microsoft uses Expression trees to play with LINQ-to-Sql.What are the different ways can i use expression trees to boost my code.
Apart from LINQ to SQL,Linq to amazon ,who used expression trees in their applications?
Linq to Object return IEnumerable,Linq to SQL return IQueryable ,What does LINQ to XML return?