Hi guys i am really couldn't realize why there is no way to get SQL request from DataContext if i only know ExpressionTree that describe this request!!!
Please somebody who understand or guess why it so give me suggestion.
I couldn't realize
Try the following code. expr is an Expression instance, context is a DataContext instance.
Code: Select all
var query = Expression.Lambda(expr).Compile().DynamicInvoke();
string s = context.GetCommand((IQueryable)query).CommandText;