/// <summary> /// Initialize the entire DependencyInversion pipeline. /// </summary> /// <param name="assemblies"><see cref="IAssemblies"/> for the application.</param> /// <param name="typeFinder"><see cref="ITypeFinder"/> for doing discovery.</param> /// <param name="scheduler"><see cref="IScheduler"/> for scheduling work.</param> /// <param name="fileSystem"><see cref="IFileSystem"/> to use.</param> /// <param name="loggerManager"><see cref="ILoggerManager"/> for creating loggers.</param> /// <param name="bindings">Additional bindings.</param> /// <param name="bootContainer">A <see cref="BootContainer"/> used during booting.</param> /// <returns>Configured <see cref="IContainer"/> and <see cref="IBindingCollection"/>.</returns> public static BootResult Start( IAssemblies assemblies, ITypeFinder typeFinder, IScheduler scheduler, IFileSystem fileSystem, ILoggerManager loggerManager, IEnumerable <Binding> bindings = null, BootContainer bootContainer = null) { var logger = loggerManager.CreateLogger(typeof(Boot)); logger.Trace("DependencyInversion start"); var initialBindings = GetBootBindings(assemblies, typeFinder, scheduler, fileSystem, loggerManager); if (bootContainer == null) { bootContainer = new BootContainer(initialBindings, new NewBindingsNotificationHub()); } _container = bootContainer; var otherBindings = new List <Binding>(); if (bindings != null) { otherBindings.AddRange(bindings); } otherBindings.Add(Bind(typeof(IContainer), () => _container, false)); logger.Trace("Discover and Build bindings"); var bindingCollection = DiscoverAndBuildBuildBindings( bootContainer, typeFinder, scheduler, logger, initialBindings, otherBindings); logger.Trace("Discover container"); _container = DiscoverAndConfigureContainer(bootContainer, assemblies, typeFinder, bindingCollection); BootContainer.ContainerReady(_container); logger.Trace("Return boot result"); return(new BootResult(_container, bindingCollection)); }
/// <summary> /// Initialize the entire DependencyInversion pipeline with a specified <see cref="Type"/> of container /// </summary> /// <param name="assemblies"><see cref="IAssemblies"/> for the application</param> /// <param name="typeFinder"><see cref="ITypeFinder"/> for doing discovery</param> /// <param name="scheduler"><see cref="IScheduler"/> for scheduling work</param> /// <param name="fileSystem"><see cref="IFileSystem"/> to use</param> /// <param name="logger"><see cref="ILogger"/> for doing logging</param> /// <param name="containerType"><see cref="Type"/>Container type</param> /// <param name="bindings">Additional bindings</param> /// <param name="bootContainer">A <see cref="BootContainer"/> used during booting</param> /// <returns>Configured <see cref="IContainer"/> and <see cref="IBindingCollection"/></returns> public static IBindingCollection Start( IAssemblies assemblies, ITypeFinder typeFinder, IScheduler scheduler, IFileSystem fileSystem, ILogger logger, Type containerType, IEnumerable <Binding> bindings = null, BootContainer bootContainer = null) { logger.Trace("DependencyInversion start"); var initialBindings = GetBootBindings(assemblies, typeFinder, scheduler, fileSystem, logger); if (bootContainer == null) { bootContainer = new BootContainer(initialBindings, new NewBindingsNotificationHub()); } _container = bootContainer; var otherBindings = new List <Binding>(); if (bindings != null) { otherBindings.AddRange(bindings); } otherBindings.Add(Bind(typeof(IContainer), containerType, true)); logger.Trace("Discover and Build bindings"); var bindingCollection = DiscoverAndBuildBuildBindings( bootContainer, assemblies, typeFinder, scheduler, logger, initialBindings, otherBindings); return(bindingCollection); }
/// <summary> /// Method that gets called when <see cref="IContainer"/> is ready. /// </summary> /// <param name="container"><see cref="IContainer"/> instance.</param> public static void ContainerReady(IContainer container) { _container = container; BootContainer.ContainerReady(container); }