2019-01-12 18:54:41 +03:00
|
|
|
|
using Benchmark.Abstractions;
|
|
|
|
|
using System;
|
2019-06-21 03:51:44 +03:00
|
|
|
|
using Unity.Lifetime;
|
2017-11-19 05:35:12 +03:00
|
|
|
|
|
|
|
|
|
namespace Unity.V6.Adapter
|
|
|
|
|
{
|
|
|
|
|
public class TestAdapter : TestAdapterBase<UnityContainer>
|
|
|
|
|
{
|
|
|
|
|
public override object CreateContainer()
|
|
|
|
|
{
|
|
|
|
|
return new UnityContainer();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public override object Singleton()
|
|
|
|
|
{
|
2019-06-21 03:51:44 +03:00
|
|
|
|
return ((IUnityContainer)Container).Resolve(typeof(IUnityContainer), null);
|
2017-11-19 05:35:12 +03:00
|
|
|
|
}
|
|
|
|
|
|
2018-02-25 09:01:08 +03:00
|
|
|
|
public override object Resolve(Type type, string name)
|
|
|
|
|
{
|
2019-01-12 18:54:41 +03:00
|
|
|
|
return ((IUnityContainer)Container).Resolve(type, name);
|
2018-02-25 09:01:08 +03:00
|
|
|
|
}
|
|
|
|
|
|
2017-11-19 05:35:12 +03:00
|
|
|
|
public override object RegisterType(Type type, string name)
|
|
|
|
|
{
|
2019-01-12 18:54:41 +03:00
|
|
|
|
return ((IUnityContainer)Container).RegisterType(null, type, name);
|
2017-11-19 05:35:12 +03:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public override object RegisterTypeSingleton(Type type, string name)
|
|
|
|
|
{
|
2019-01-12 18:54:41 +03:00
|
|
|
|
return ((IUnityContainer)Container).RegisterType(type, name, new ContainerControlledLifetimeManager());
|
2017-11-19 05:35:12 +03:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public override object RegisterTypeMapping(Type from, Type to, string name)
|
|
|
|
|
{
|
2019-01-12 18:54:41 +03:00
|
|
|
|
return ((IUnityContainer)Container).RegisterType(from, to, name);
|
2017-11-19 05:35:12 +03:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public override object RegisterTypeMappingSingleton(Type from, Type to, string name)
|
|
|
|
|
{
|
2019-01-12 18:54:41 +03:00
|
|
|
|
return ((IUnityContainer)Container).RegisterType(from, to, name, new ContainerControlledLifetimeManager());
|
2017-11-19 05:35:12 +03:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|