12345678910111213141516171819202122232425262728293031323334353637383940 |
- using System;
- using System.Collections.Generic;
- using System.Text;
- namespace Wayne.Lib
- {
- /// <summary>
- /// Factory to create ServiceContainer.
- /// </summary>
- public static class ServiceContainerFactory
- {
- /// <summary>
- /// Creates new service container.
- /// </summary>
- /// <returns>New service container.</returns>
- public static IServiceContainer Create()
- {
- return new ServiceContainer();
- }
- /// <summary>
- /// Creates new service container with a parent service locator from where the newly created service container
- /// can look for services if it does not find them in its own container.
- /// </summary>
- /// <param name="parentServiceLocator">Parent service container.</param>
- /// <returns>New service container.</returns>
- public static IServiceContainer Create(IServiceLocator parentServiceLocator)
- {
- return new ServiceContainer(parentServiceLocator);
- }
- public static IServiceContainer Create(Func<Type, object> resolver)
- {
- var container=new ServiceContainer();
- container.RegisterResolver(resolver);
- return container;
- }
- }
- }
|