mirror of https://github.com/ogoun/Zero.git
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
67 lines
1.7 KiB
67 lines
1.7 KiB
using System.Collections.Generic;
|
|
using ZeroLevel.DependencyInjection;
|
|
|
|
namespace ZeroLevel
|
|
{
|
|
public static class Injector
|
|
{
|
|
private const string DEFAULT_CONTAINER_NAME = "__default_application_container__";
|
|
private readonly static IContainerFactory _containerFactory;
|
|
private readonly static IContainer _defaultContainer;
|
|
|
|
public static IContainer Default
|
|
{
|
|
get
|
|
{
|
|
return _defaultContainer;
|
|
}
|
|
}
|
|
|
|
static Injector()
|
|
{
|
|
_containerFactory = new ContainerFactory();
|
|
_defaultContainer = _containerFactory.CreateContainer(DEFAULT_CONTAINER_NAME);
|
|
}
|
|
|
|
public static IEnumerable<string> ContainerNames
|
|
{
|
|
get
|
|
{
|
|
return _containerFactory.ContainerNames;
|
|
}
|
|
}
|
|
|
|
public static IEnumerable<IContainer> Containers
|
|
{
|
|
get
|
|
{
|
|
return _containerFactory.Containers;
|
|
}
|
|
}
|
|
|
|
public static bool Contains(string containerName)
|
|
{
|
|
return _containerFactory.Contains(containerName);
|
|
}
|
|
|
|
public static IContainer CreateContainer(string containerName)
|
|
{
|
|
return _containerFactory.CreateContainer(containerName);
|
|
}
|
|
|
|
public static void Dispose()
|
|
{
|
|
_containerFactory.Dispose();
|
|
}
|
|
|
|
public static IContainer GetContainer(string containerName)
|
|
{
|
|
return _containerFactory[containerName];
|
|
}
|
|
|
|
public static bool Remove(string containerName)
|
|
{
|
|
return _containerFactory.Remove(containerName);
|
|
}
|
|
}
|
|
} |