/// <summary> /// Initializes a new instance of the <see cref="ChildContainer"/> class. /// </summary> /// <param name="serviceMappings">The service mappings.</param> /// <param name="parentStorage">The parent storage.</param> /// <param name="childStorage">The child storage.</param> /// <param name="disposedCallback">Invoked when the container is disposed.</param> public ChildContainer(IServiceMappings serviceMappings, IInstanceStorage parentStorage, IInstanceStorage childStorage, Action disposedCallback) : base(serviceMappings) { _parentStorage = parentStorage; _childStorage = childStorage; _disposedCallback = disposedCallback; }
/// <summary> /// Initializes a new instance of the <see cref="Container"/> class. /// </summary> /// <param name="serviceMappings">The service mappings which as been generated by a <see cref="IContainerBuilder"/>.</param> /// <param name="factory">Used to create the storage</param> public Container(IServiceMappings serviceMappings, IInstanceStorageFactory factory) : base(serviceMappings) { if (serviceMappings == null) { throw new ArgumentNullException("serviceMappings"); } _factory = factory; _storage = factory.CreateParent(); }
/// <summary> /// Initializes a new instance of the <see cref="ContainerBase"/> class. /// </summary> /// <param name="serviceMappings">The service mappings.</param> protected ContainerBase(IServiceMappings serviceMappings) { if (serviceMappings == null) { throw new ArgumentNullException("serviceMappings"); } _serviceMappings = serviceMappings; foreach (var mapping in serviceMappings) { foreach (var concrete in mapping.Value) { concrete.SetCreateCallback(this); } } }
public void Execute() { serviceMappings = Activator.CreateInstance <T>(); container = DIContainer.RegisterContainer(InstanceServerApplication.CONTEXT_ID); // Game controller. container.MapType <IGameController, CoOpInstanceGameController>(); // PlayerCombatBehaviour container.MapType <PlayerCombatBehaviourBase, ManualInputBehaviour>(); // SessionService container.RegisterInstance <SessionServiceBase>(serviceMappings.GetSessionServiceInstance()); // Join Room Controller container.RegisterInstance <JoinRoomController>(new JoinRoomController()); // CatalogService CatalogServiceBase catalogService = serviceMappings.GetCatalogServiceInstance(); container.RegisterInstance <CatalogServiceBase>(catalogService); catalogService.GetCatalog("PlayerOwnedItems", onCatalogReceived, onGetCatalogFailed); }