-
Notifications
You must be signed in to change notification settings - Fork 0
/
ErrorUnitInjector.cs
42 lines (39 loc) · 1.22 KB
/
ErrorUnitInjector.cs
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
34
35
36
37
38
39
40
41
42
using Autofac;
using Castle.DynamicProxy;
using ErrorUnit.Interfaces;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace ErrorUnit.Injector_Autofac
{
/// <summary>
/// The Injector link for Autofac
/// </summary>
public class ErrorUnitInjector : IInjector
{
/// <summary>
/// The Autofac ContainerBuilder
/// </summary>
private static ContainerBuilder container = null;
/// <summary>
/// The json serializer to use
/// </summary>
public static IErrorUnitCentral ErrorUnitCentral;
/// <summary>
/// Links the injector.
/// </summary>
/// <typeparam name="C"></typeparam>
/// <param name="ioc">The ioc.</param>
/// <param name="errorUnitCentral">The ErrorUnitCentral.Instance</param>
/// <returns></returns>
public C LinkInjector<C>(C ioc, IErrorUnitCentral errorUnitCentral)
{
container = ioc as ContainerBuilder;
ErrorUnitInjector.ErrorUnitCentral = errorUnitCentral;
container.Register(c => errorUnitCentral.ErrorUnitInterceptor);
return ioc;
}
}
}