So here is the scenario: i have a series of different repository classes that each can use an isolated data context, or a shared context. In the cases where an isolated cont
Something like this:
public IEnumerable ExecuteInContext(
Expression> predicate)
{
... // do your stuff
//eg
Table t = GetTable();
return t.Where(predicate);
}
or
public IEnumerable ExecuteInContext(
IQueryable src, Expression> predicate)
{
return src.Where(predicate);
}
Usage:
var r = repo.ExecuteInContext(
x => x.SomeProp.Equals(Somevalue));
or
var r = repo.ExecuteInContext(GetTable(),
x => x.SomeProp.Equals(Somevalue));
Assumptions: