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

Add note about ToInterceptor method #46

Merged
merged 1 commit into from
May 17, 2018
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
12 changes: 11 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -327,6 +327,16 @@ public class MyProcessingAsyncInterceptor : ProcessingAsyncInterceptor<object>
}
```

## Using AsyncInterceptor with non-overloaded `ProxyGenerator` methods

While AsyncInterceptor offers convenient overloads for the most common `ProxyGenerator` methods, some methods do not (yet) have such overloads. In this case, the extension method `IAsyncInterceptor.ToInterceptor()` can be used to obtain a regular `IInterceptor` implementation.

```csharp
var generator = new ProxyGenerator();
var interceptor = new MyInterceptorWithoutTarget<T>();
generator.CreateInterfaceProxyWithoutTarget(typeof(T), interceptor.ToInterceptor());
```

## Method invocation timing using `AsyncTimingInterceptor`

A common use-case for method invocation interception is to time how long a method takes to execute. For this reason
Expand Down Expand Up @@ -403,4 +413,4 @@ coverage.cmd

Code coverage reports are produced using
[ReportGenerator](https://github.com/danielpalme/ReportGenerator "ReportGenerator Repository") and can be viewed in the
`test/TestResults/Report` folder.
`test/TestResults/Report` folder.