protected override void OnExit(object sender, EventArgs e) { //TODO fix ConEmu errors on close... _container?.Dispose(); Environment.Exit(0); }
private static void RunTheHostFactory(IWindsorContainer container) { HostFactory.Run(config => { config.Service<IGenericService>(settings => { settings.ConstructUsing(hostSettings => container.Resolve<IGenericService>()); settings.WhenStarted(service => service.Start()); settings.WhenStopped(service => { service.Stop(); container.Release(service); container.Dispose(); }); settings.WhenPaused(service => { }); settings.WhenContinued(service => { }); }); config.RunAsLocalSystem(); var serviceDescription = container.Resolve<ServiceDescription>(); config.SetDescription(serviceDescription.Description); config.SetDisplayName(serviceDescription.DisplayName); config.SetServiceName(serviceDescription.ServiceName); }); }
protected virtual void Dispose(bool disposing) { if (disposing) { container?.Dispose(); } }
public void all_registered_types() { sut = WindsorContainerFactory.Create(false); foreach (var handler in sut.Kernel.GetAssignableHandlers(typeof (object))) Console.WriteLine("{0} {1}", handler.ComponentModel.Service, handler.ComponentModel.Implementation); sut.Dispose(); }
static void Main(string[] args) { container = BotRunnerBootstrapper.Init(); var fineBot = new Bot(); var fineBotResponders = container.ResolveAll<IFineBotResponder>(); foreach (IFineBotResponder responder in fineBotResponders) { fineBot.Responders.Add(responder); } fineBot.RespondsTo("hi").IfBotIsMentioned().With("Stop resisting citizen!"); fineBot.CreateResponder(x => !x.BotHasResponded, rc => "My responses are limited, you must ask the right question..."); var task = fineBot.Connect(ConfigurationManager.AppSettings["BotKey"]); Console.WriteLine(string.Format("{0}: Bot is runnning, type 'die' to make it die", DateTime.Now)); var secondCousinBot = new Bot(); var secondCousinResponders = container.ResolveAll<ISecondCousinResponder>(); foreach (ISecondCousinResponder responder in secondCousinResponders) { secondCousinBot.Responders.Add(responder); } var seconderTask = secondCousinBot.Connect(ConfigurationManager.AppSettings["SeconderBotKey"]); Console.WriteLine(string.Format("{0}: Finebot's second cousin is also also running. Some say he can't die.", DateTime.Now)); while(Console.ReadLine() != "die") { } container.Dispose(); }
public void resolve_with_Web_config() { sut = WindsorContainerFactory.Create(true); Assert.IsInstanceOf(typeof(WebCacheManager), sut.Resolve<ICacheManager>()); Assert.IsInstanceOf(typeof(TerminalTasks), sut.Resolve<ITerminalTasks>()); resolve_common_types(); sut.Dispose(); }
public static void Dispose() { lock (sync) { innerContainer?.Dispose(); innerContainer = null; } }
public void Create_WindsorContainer_from_WindsorContainerFactory() { sut = WindsorContainerFactory.Create(false); foreach(var g in sut.Kernel.GraphNodes) if(g.Dependers.Length == 0) { Console.WriteLine(); WalkGraph(g, 0); } sut.Dispose(); }
protected virtual void Dispose(bool disposing) { if (disposing) { client?.Dispose(); tokenSource?.Dispose(); container?.Dispose(); handler?.Dispose(); } }
/// <summary> /// Handles the End event of the Application control. /// </summary> /// <param name="sender">The source of the event.</param> /// <param name="e">The <see cref="System.EventArgs" /> instance containing the event data.</param> private void Application_End(object sender, EventArgs e) { _log.Information("[stopping]"); _bus?.Dispose(); _container?.Dispose(); _log.Information("[stopped]"); LogManager.Shutdown(); }
public void resolve_with_Wpf_configuration() { sut = WindsorContainerFactory.Create(false); Assert.IsInstanceOf(typeof(WinCacheManager), sut.Resolve<ICacheManager>()); Assert.IsInstanceOf(typeof(EventWrappedTerminalTasks), sut.Resolve<ITerminalTasks>()); Assert.IsInstanceOf(typeof(EventWrappedTerminalTasks), sut.Resolve<ITerminalEvents>()); Assert.AreSame(sut.Resolve<ITerminalTasks>(), sut.Resolve<ITerminalEvents>()); Assert.IsInstanceOf(typeof(ScopedTerminalTasks), sut.Resolve<ITerminalTasks>(typeof(ScopedTerminalTasks).FullName)); Assert.IsInstanceOf(typeof(TerminalTasks), sut.Resolve<ITerminalTasks>(typeof(TerminalTasks).FullName)); resolve_common_types(); sut.Dispose(); }
private void Dispose(bool disposing) { if (_disposed) { return; } if (!disposing) { return; } _container?.Dispose(); _container = null; _disposed = true; }
protected virtual void Dispose(bool disposing) { if (Disposed) { return; } if (disposing) { CancelAll.Cancel(); Container?.Dispose(); Container = null; } Disposed = true; }
public static void Main(string[] args) { Console.WriteLine("Starting Main"); container=new WindsorContainer(); container.Install( FromAssembly.This() ); IMain app=container.Resolve<IMain>(); app.Begin(); app.AddSomeBlogs(); app.GetBlogByTitle("Blog 3"); app.AddSomeCommentsTo("Blog 3"); app.CountAllComments(); Console.Write("Completed."); container.Dispose(); Console.ReadKey(true); }
private static void RunTheHostFactory(IWindsorContainer container) { HostFactory.Run(config => { config.Service<IHostedService>(settings => { settings.ConstructUsing(hostSettings => { var service = container.Resolve<IHostedService>(); return service; }); settings.WhenStarted(service => service.Start()); settings.WhenStopped(service => { service.Stop(); container.Release(service); container.Dispose(); }); settings.WhenPaused(service => service.Pause()); settings.WhenContinued(service => service.Continue()); }); config.BeforeInstall(() => { }); config.AfterUninstall(() => { }); config.RunAsLocalSystem(); var serviceDescription = container.Resolve<ServiceDescription>(); config.SetDescription(serviceDescription.Description); config.SetDisplayName(serviceDescription.DisplayName); config.SetServiceName(serviceDescription.ServiceName); config.DependsOnEventLog(); }); }
static void Main(string[] args) { container = BotRunnerBootstrapper.Init(); Bot bot = new Bot(); foreach(IResponder responder in container.ResolveAll<IResponder>()) { bot.Responders.Add(responder); } bot.RespondsTo("hi").IfBotIsMentioned().With("Stop resisting citizen!"); var task = bot.Connect(ConfigurationManager.AppSettings["SlackApiKey"]); Console.WriteLine(String.Format("{0}: Bot is runnning, type 'die' to make it die", DateTime.Now)); while(Console.ReadLine() != "die") { } container.Dispose(); }
public void TestFixtureTeardown() { HttpContext.Current = null; container.Dispose(); }
public void Terminate() { container.Dispose(); }
public void Stop() { _bus?.Dispose(); _container?.Dispose(); }
public Boolean Stop() { _container.Dispose(); return(true); }
protected void GenerateContainer() { _container?.Dispose(); //if we already registered container, just dispose the old one. _container = new WindsorContainer(); _container.Kernel.Resolver.AddSubResolver(new CollectionResolver(_container.Kernel, true)); _container.Kernel.Resolver.AddSubResolver(new ArrayResolver(_container.Kernel, true)); _container.AddFacility <JarvisTypedFactoryFacility>(); _loggerInstance = new TestLogger("Test", LoggerLevel.Info); _container.Register( Component .For <ILogger>() .Instance(_loggerInstance), Component .For <ILoggerFactory>() .AsFactory(), Component .For <INStoreLoggerFactory>() .ImplementedBy <NStoreCastleLoggerFactory>(), Component .For <IMongoDatabase>() .Instance(_db), Component .For <IPersistence>() .Instance(_persistence), Component .For <IIdentityManager, IIdentityConverter>() .Instance(_identityManager), Component .For <ICommitEnhancer>() .ImplementedBy <CommitEnhancer>(), Component .For <AtomicProjectionCheckpointManager>(), Component .For <AtomicProjectionEngine>() .ImplementedBy <AtomicProjectionEngine>(), Component .For <ILiveAtomicReadModelProcessor>() .ImplementedBy <LiveAtomicReadModelProcessor>(), Component .For <ICommitPollingClient>() .ImplementedBy <CommitPollingClient2>() .LifeStyle.Transient, Component .For <IAtomicReadModelFactory>() .ImplementedBy <AtomicReadModelFactory>(), Component .For <IAtomicReadmodelProjectorHelperFactory>() .ImplementedBy <AtomicReadmodelProjectorHelperFactory>() .DependsOn(Dependency.OnValue <IWindsorContainer>(_container)), //I Know, this is not optima, we will refactor this to a facility. Component .For <ICommitPollingClientFactory>() .AsFactory(), Component.For(typeof(AtomicReadmodelProjectorHelper <>)) .ImplementedBy(typeof(AtomicReadmodelProjectorHelper <>)), Component .For(new Type[] { typeof(IAtomicMongoCollectionWrapper <>), typeof(IAtomicCollectionWrapper <>), typeof(IAtomicCollectionReader <>), }) .ImplementedBy(typeof(AtomicMongoCollectionWrapper <>)) .Named("AtomicMongoCollectionWrapper"), Component .For <IAtomicCollectionWrapperFactory>() .AsFactory(), Component .For <AtomicReadModelSignatureFixer>() .LifestyleTransient() ); }
public static void Release(IWindsorContainer container) { container.Dispose(); }
public static void Reset() { _container?.Dispose(); _container = new WindsorContainer(); }
/// <summary> </summary> public void Application_OnEnd() { container.Dispose(); }
public void TearDown() { _container.Dispose(); }
public void Cleanup() { _container.Dispose(); }
public void Dispose() { windsorContainer.Dispose(); }
public static void DisposeContainer() { container.Dispose(); }
public void Close_container() { _container.Dispose(); }
public void Teardown() { container.Dispose(); }
/// <summary> /// Releases the container. /// </summary> public static void ReleaseContainer() { Container.Dispose(); }
public override void Dispose() { container.Dispose(); }
protected void Application_End(object sender, EventArgs e) { _container?.Dispose(); }
public void Dispose() { _container.Dispose(); }
public void TearDown() { _containerToDisposeAfterTest?.Dispose(); }
internal static void Shutdown() { container.Dispose(); }
public static void Shutdown() { _container?.Dispose(); }
private void Application_Exit(object sender, ExitEventArgs e) { _scope?.Dispose(); _container.Dispose(); }
protected void Application_End() { _container.Dispose(); }
protected override void OnExit(object sender, EventArgs e) { container.Dispose(); base.OnExit(sender, e); }