Created
February 7, 2012 13:51
-
-
Save jritsema/1759776 to your computer and use it in GitHub Desktop.
InterceptingProvider's Execute Implementation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public IEnumerator<T> ExecuteQuery(Expression expression) | |
{ | |
//intercept expression | |
var interceptedExpression = InterceptExpression(expression); | |
//execute query using underlying provider | |
var enumerator = _underlyingProvider.CreateQuery<T>(interceptedExpression).GetEnumerator(); | |
//is post processing hook specified? | |
if (this.AfterQueryExecutedHandler != null) | |
{ | |
var queryResults = new List<T>(); | |
while (enumerator.MoveNext()) | |
queryResults.Add(enumerator.Current); | |
//call the handler with the query results | |
this.AfterQueryExecutedHandler(interceptedExpression, queryResults); | |
//return list so that WCF Data Services can proceed | |
return queryResults.GetEnumerator(); | |
} | |
return enumerator; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment