-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathUnityInterceptionBenchmark.cs
More file actions
33 lines (26 loc) · 970 Bytes
/
Copy pathUnityInterceptionBenchmark.cs
File metadata and controls
33 lines (26 loc) · 970 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
using Microsoft.Practices.Unity;
using Microsoft.Practices.Unity.InterceptionExtension;
namespace InterceptionBenchmarks
{
internal sealed class UnityInterceptionBenchmark
{
private readonly UnityContainer _container;
public UnityInterceptionBenchmark()
{
_container = new UnityContainer();
_container.AddNewExtension<Interception>();
_container.Configure<Interception>()
.AddPolicy("Metering")
.AddMatchingRule(new SingleMethodMatchingRule())
.AddCallHandler(new UnityCallHandler());
_container.RegisterType<ISomething, Something>(
new Interceptor<InterfaceInterceptor>(),
new InterceptionBehavior<PolicyInjectionBehavior>());
}
public void Run()
{
var something = _container.Resolve<ISomething>();
something.Foo();
}
}
}