I expose an IQueryable method from my business layer for use in other layers. I would like to execute a function against each of the items in the enumeration, once the query has executed down-level.
It seems like there should be an event that is raised after the query executes, so that I can then operate on the results from this common layer.
Something like:
public IQueryable<User> Query()
{
return _Repository.Query<User>().ForEachDelayed(u=> AppendData(u));
}
I want the ForEachDelayed function to return the IQueryable without executing the query. The idea is, once the query is executed, the results are passed through this delegate.
Is there something like this out there? If not, is there an event like "IQueryable.OnExecute" that I can subscribe to?
Any help would be awesome -- thanks!
EDIT:
I thought I had the answer with this:
var users = from u in _Repository.Query<User>()
select AppendData(u);
return users;
But now, I get the following error:
Method 'AppendData(User)' has no supported translation to SQL.
I really need a delegate to run AFTER the query has executed.