Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Convert internal field to public property to allow external access. #51

Merged
merged 1 commit into from
Mar 8, 2019
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -23,14 +23,12 @@ public class AsyncDeterminationInterceptor : IInterceptor
private static readonly ConcurrentDictionary<Type, GenericAsyncHandler> GenericAsyncHandlers =
new ConcurrentDictionary<Type, GenericAsyncHandler>();

private readonly IAsyncInterceptor _asyncInterceptor;

/// <summary>
/// Initializes a new instance of the <see cref="AsyncDeterminationInterceptor"/> class.
/// </summary>
public AsyncDeterminationInterceptor(IAsyncInterceptor asyncInterceptor)
{
_asyncInterceptor = asyncInterceptor;
AsyncInterceptor = asyncInterceptor;
}

private delegate void GenericAsyncHandler(IInvocation invocation, IAsyncInterceptor asyncInterceptor);
Expand All @@ -42,6 +40,11 @@ private enum MethodType
AsyncFunction,
}

/// <summary>
/// Gets the underlying async interceptor
/// </summary>
public IAsyncInterceptor AsyncInterceptor { get; }

/// <summary>
/// Intercepts a method <paramref name="invocation"/>.
/// </summary>
Expand All @@ -54,13 +57,13 @@ public virtual void Intercept(IInvocation invocation)
switch (methodType)
{
case MethodType.AsyncAction:
_asyncInterceptor.InterceptAsynchronous(invocation);
AsyncInterceptor.InterceptAsynchronous(invocation);
return;
case MethodType.AsyncFunction:
GetHandler(invocation.Method.ReturnType).Invoke(invocation, _asyncInterceptor);
GetHandler(invocation.Method.ReturnType).Invoke(invocation, AsyncInterceptor);
return;
default:
_asyncInterceptor.InterceptSynchronous(invocation);
AsyncInterceptor.InterceptSynchronous(invocation);
return;
}
}
Expand Down