benchmarks-del/Unity.V6.Adapter/TestAdapter.cs

45 строки
1.5 KiB
C#
Исходник Обычный вид История

2019-01-12 18:54:41 +03:00
using Benchmark.Abstractions;
using System;
2019-06-21 03:51:44 +03:00
using Unity.Lifetime;
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);
}
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
}
public override object RegisterType(Type type, string name)
{
2019-01-12 18:54:41 +03:00
return ((IUnityContainer)Container).RegisterType(null, type, name);
}
public override object RegisterTypeSingleton(Type type, string name)
{
2019-01-12 18:54:41 +03:00
return ((IUnityContainer)Container).RegisterType(type, name, new ContainerControlledLifetimeManager());
}
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);
}
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());
}
}
}