-
Notifications
You must be signed in to change notification settings - Fork 11
/
Copy path_ContainerFactory.cs
31 lines (23 loc) · 1.03 KB
/
_ContainerFactory.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
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using _IoC = Saraff.IoC;
namespace Saraff.Twain.DS.IoC {
internal sealed class _ContainerFactory : Component, IContainerFactory {
private _IoC.ServiceContainer _container;
public _ContainerFactory(_IoC.ServiceContainer container) => this._container = container;
#region IContainerFactory
public IServiceProvider Create() {
var _nested = this._container.CreateNestedContainer();
_nested.Bind<IoC.IInstanceFactory>(_nested.CreateInstance<IoC._InstanceFactory>(i => i("container", _nested)));
_nested.Bind<IoC.IBinder>(_nested.CreateInstance<IoC._Binder>(i => i("container", _nested)));
_nested.Bind<IoC.IContainerFactory>(_nested.CreateInstance<IoC._ContainerFactory>(i => i("container", _nested)));
_nested.Bind<IServiceProvider>(_nested);
return _nested;
}
#endregion
}
}