Created
October 28, 2009 10:04
-
-
Save jfromaniello/220383 to your computer and use it in GitHub Desktop.
This file contains hidden or 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 class ConversationQueryable<T> : IQueryable<T> | |
{ | |
private readonly IConversationsContainerAccessor _conversationsContainerAccessor; | |
private readonly IQueryable<T> _realQueryable; | |
public ConversationQueryable( | |
IConversationsContainerAccessor conversationsContainerAccessor, | |
IQueryable<T> realQueryable) | |
{ | |
_conversationsContainerAccessor = conversationsContainerAccessor; | |
_realQueryable = realQueryable; | |
} | |
public IEnumerator<T> GetEnumerator() | |
{ | |
_conversationsContainerAccessor.Container.CurrentConversation.Resume(); | |
try | |
{ | |
return _realQueryable.GetEnumerator(); | |
} | |
finally | |
{ | |
_conversationsContainerAccessor.Container.CurrentConversation.Pause(); | |
} | |
} | |
IEnumerator IEnumerable.GetEnumerator() | |
{ | |
return GetEnumerator(); | |
} | |
public Expression Expression | |
{ | |
get { return _realQueryable.Expression; } | |
} | |
public Type ElementType | |
{ | |
get { return _realQueryable.ElementType; } | |
} | |
public IQueryProvider Provider | |
{ | |
get { return _realQueryable.Provider; } | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment