Skip to content

Commit a1c5d25

Browse files
committed
Update README.md
1 parent 0b2953a commit a1c5d25

File tree

1 file changed

+20
-15
lines changed

1 file changed

+20
-15
lines changed

README.md

Lines changed: 20 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,28 @@
11
# Ninject.Extensions.Interception
22

3-
[![NuGet Version](http://img.shields.io/nuget/v/Ninject.Extensions.Interception.svg?style=flat)](https://www.nuget.org/packages/Ninject.Extensions.Interception/)
4-
[![Build status](https://ci.appveyor.com/api/projects/status/so14qvg5mim275pf?svg=true)](https://ci.appveyor.com/project/scott-xu/ninject-extensions-interception)
3+
[![Build status](https://ci.appveyor.com/api/projects/status/nj6mp01qeem166y8?svg=true)](https://ci.appveyor.com/project/Ninject/ninject-extensions-interception)
54
[![codecov](https://codecov.io/gh/ninject/Ninject.Extensions.Interception/branch/master/graph/badge.svg)](https://codecov.io/gh/ninject/Ninject.Extensions.Interception)
5+
[![NuGet Version](http://img.shields.io/nuget/v/Ninject.Extensions.Interception.svg?style=flat)](https://www.nuget.org/packages/Ninject.Extensions.Interception/)
6+
[![NuGet Download](http://img.shields.io/nuget/dt/Ninject.Extensions.Interception.svg?style=flat)](https://www.nuget.org/packages/Ninject.Extensions.Interception/)
7+
8+
This extension adds support for interception to Ninject.
9+
10+
For example, the WCF client proxy can be intercepted as below.
611

7-
ChannelProxies can be intercepted now:
812
```C#
9-
[ServiceContract]
10-
public interface IFooService
11-
{
12-
[OperationContract]
13-
void Foodo();
14-
}
13+
[ServiceContract]
14+
public interface IFooService
15+
{
16+
[OperationContract]
17+
void Foodo();
18+
}
1519

16-
ActionInterceptor interceptor =
17-
new ActionInterceptor( invocation => Console.WriteLine("Executing {0}.", invocation.Request.Method) );
20+
var interceptor =
21+
new ActionInterceptor(
22+
invocation => Console.WriteLine($"Executing {invocation.Request.Method}."));
1823

19-
kernel.Bind<IFooService>()
20-
.ToMethod(context => ChannelFactory<IFooService>.CreateChannel(new NetTcpBinding(), new EndpointAddress("net.tcp://localhost/FooService")))
21-
.Intercept(typeof(ICommunicationObject))
22-
.With(interceptor);
24+
kernel.Bind<IFooService>()
25+
.ToMethod(context => ChannelFactory<IFooService>.CreateChannel("*"))
26+
.Intercept(typeof(ICommunicationObject))
27+
.With(interceptor);
2328
```

0 commit comments

Comments
 (0)