summaryrefslogtreecommitdiff
path: root/code/common/AutofacDependencyRegistry.cs
blob: 8391dbe39988c463554ca9b95fe31afb187ef220 (plain)
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
using System;
using System.Collections.Generic;
using Autofac;

namespace common
{
    public class AutofacDependencyRegistry : DependencyRegistry
    {
        readonly Func<IContainer> container;

        public AutofacDependencyRegistry(Func<IContainer> container)
        {
            this.container = container;
        }

        public Interface get_a<Interface>()
        {
            return container().Resolve<Interface>();
        }

        public IEnumerable<Interface> get_all<Interface>()
        {
            return container().Resolve<IEnumerable<Interface>>();
        }
    }
}