private void CreateBootstrapper(ICollection <Type> bootstrappers) { foreach (Type boostrapperType in bootstrappers) { var bootstrapper = _resolver.Resolve(boostrapperType) as StoveBootstrapper; if (bootstrapper == null) { throw new StoveInitializationException("This type is not an Stove bootstrapper: " + boostrapperType.AssemblyQualifiedName); } bootstrapper.Resolver = _resolver; bootstrapper.StoveConfiguration = _resolver.Resolve <IStoveStartupConfiguration>(); bootstrapper.Logger = _resolver.Resolve <ILogger>(); var bootstrapperInfo = new BootstrapperInfo(boostrapperType, bootstrapper); _bootstrappers.Add(bootstrapperInfo); } }
private void SetDependencies() { foreach (BootstrapperInfo bootstrapperInfo in _bootstrappers) { bootstrapperInfo.Dependencies.Clear(); //Set dependencies for defined DependsOnAttribute attribute(s). foreach (Type dependedBootstrapperType in StoveBootstrapper.FindDependedBootstrapperTypes(bootstrapperInfo.Type)) { BootstrapperInfo dependedBootstrapperInfo = _bootstrappers.FirstOrDefault(m => m.Type == dependedBootstrapperType); if (dependedBootstrapperInfo == null) { throw new StoveInitializationException("Could not find a depended bootstrapper " + dependedBootstrapperType.AssemblyQualifiedName + " for " + bootstrapperInfo.Type.AssemblyQualifiedName); } if (bootstrapperInfo.Dependencies.FirstOrDefault(dm => dm.Type == dependedBootstrapperType) == null) { bootstrapperInfo.Dependencies.Add(dependedBootstrapperInfo); } } } }