Im trying to extract this expression:
t => t.DayEnd == s.DayEnd && t.DayStart == s.DayStart
into extern variable called expression.
And I want it to extract it in a way so i can use this variable in the next BlToolkit LINQ query.
private void InsertOrUpdate(IQueryable<CccPricingPricedDays> source, Table<CccPricingPricedDays> target)
{
Expression<Func<CccPricingPricedDays,CccPricingPricedDays, bool>> expression = (s,t) => t.DayEnd == s.DayEnd && t.DayStart == s.DayStart;
//doplneni chybejicich
source.Where(s => !target.Any(t => t.DayEnd == s.DayEnd && t.DayStart == s.DayStart))
.Insert(target, table => table);
}
I can find a way how to insert the variable so it can be compiled.
If you want to reuse expressions with Linq, you may want to have a look at LinqKit. It walks inside your expression and replaces all the function calls by their contents before the sql conversion.
For example :