static void Main(string[] args) { ServiceHost svcHost = null; try { var container = new WindsorContainer(); container.AddFacility <WcfFacility>().Install(FromAssembly.Named("SystemManagament")); container.Register(Component.For <IWorkstationMonitorService>().ImplementedBy <WorkstationMonitorService>()); var assemblyQualifiedName = typeof(IWorkstationMonitorService).AssemblyQualifiedName; //var factory = new DefaultServiceHostFactory(container.Kernel); var serviceHost = new DefaultServiceHostFactory().CreateServiceHost(assemblyQualifiedName, new Uri[0]); //var serviceHost = new DefaultServiceHostFactory() // .CreateServiceHost(assemblyQualifiedName, new[] { new Uri("net.tcp://localhost:8000/") }); serviceHost.Open(); Console.WriteLine("\n\nService is running."); } catch (Exception ex) { Console.WriteLine($"Service can not be started \n\nError Message: [{ex.Message}]"); } finally { Console.WriteLine("\nPress any key to close the Service"); Console.ReadKey(); svcHost.Close(); svcHost = null; } }
public void Install(IWindsorContainer container, IConfigurationStore store) { // Register Messagebox service to help castle satisfy dependencies on it container .Register(Component.For <IMessageBoxService>() .ImplementedBy <MessageBoxService>().LifestyleSingleton()); container.Register(Component.For <IMRUListViewModel>().Instance(MRULib.MRU_Service.Create_List()).LifestyleSingleton()); try { string fullPath = System.Reflection.Assembly.GetAssembly(typeof(Installers)).Location; string dir = System.IO.Path.GetDirectoryName(fullPath); container.Install(FromAssembly.Named(System.IO.Path.Combine(dir, "Edi.Core.dll"))); container.Install(FromAssembly.Named(System.IO.Path.Combine(dir, "Edi.Themes.dll"))); container.Install(FromAssembly.Named(System.IO.Path.Combine(dir, "Edi.Settings.dll"))); } catch (Exception exp) { Logger.Error(exp); } container .Register(Component.For <IAvalonDockLayoutViewModel>() .ImplementedBy <AvalonDockLayoutViewModel>().LifestyleSingleton()); container .Register(Component.For <IDocumentTypeManager>() .ImplementedBy <DocumentTypeManager>().LifestyleSingleton()); container .Register(Component.For <IFileOpenService, IApplicationViewModel>() .ImplementedBy <ApplicationViewModel>().LifestyleSingleton()); try { string fullPath = System.Reflection.Assembly.GetAssembly(typeof(Installers)).Location; string dir = System.IO.Path.GetDirectoryName(fullPath); container.Install(FromAssembly.Named(System.IO.Path.Combine(dir, "Output.dll"))); container.Install(FromAssembly.Named(System.IO.Path.Combine(dir, "Files.dll"))); container.Install(FromAssembly.Named(System.IO.Path.Combine(dir, "Edi.Documents.dll"))); container.Install(FromAssembly.Named(System.IO.Path.Combine(dir, @"Plugins\Log4NetTools\Log4NetTools.dll"))); } catch (Exception exp) { Logger.Error(exp); } // Register shell to have a MainWindow to start up with container .Register(Component.For <Edi.Apps.IShell <MainWindow> >() .ImplementedBy <Edi.Apps.Shell>().LifestyleTransient()); // Register MainWindow to help castle satisfy Shell dependencies on it container.Register(Component.For <MainWindow>().LifestyleTransient()); }
private static void LoadInstallers(IWindsorContainer container) { container.Install( FromAssembly.This(), FromAssembly.Named("PayStuffLib") ); }
/// <summary> /// Implements the <see cref="IWindsorInstaller"/> interface to /// performs the installation in the <see cref="IWindsorContainer"/> /// (performed automatically when Castle scans the containing assembly). /// </summary> /// <param name="container"></param> /// <param name="store"></param> public void Install(IWindsorContainer container, IConfigurationStore store) { try { string fullPath = System.Reflection.Assembly.GetAssembly(typeof(Installers)).Location; string dir = System.IO.Path.GetDirectoryName(fullPath); container.Install(FromAssembly.Named(System.IO.Path.Combine(dir, "Output.dll"))); container.Install(FromAssembly.Named(System.IO.Path.Combine(dir, "Files.dll"))); container.Install(FromAssembly.Named(System.IO.Path.Combine(dir, "Edi.Documents.dll"))); container.Install(FromAssembly.Named(System.IO.Path.Combine(dir, @"Plugins\Log4NetTools\Log4NetTools.dll"))); } catch (Exception exp) { Logger.Error(exp); } // Register shell to have a MainWindow to start up with container .Register(Component.For <Edi.Apps.IShell <MainWindow> >() .ImplementedBy <Edi.Apps.Shell>().LifestyleTransient()); // Register MainWindow to help castle satisfy Shell dependencies on it container.Register(Component.For <MainWindow>().LifestyleTransient()); }
/// <inheritdoc /> protected override void OnInstall(IWindsorContainer container, IConfigurationStore store) { Arguments.NotNull(container, nameof(container)); var sorted = this.assemblies.OrderByDescending(x => x.LocalPath.ContainsCaseInsensitive("plugin")); foreach (var assembly in sorted) { if (assembly == null) { continue; } this.logger.Debug("Running Installers in:{0}", assembly.LocalPath); try { var installers = FromAssembly.Named(assembly.LocalPath); installers.Install(container, store); } catch (Exception ex) { this.logger.Error(ex, "installer:{0}", assembly.LocalPath); } } }
/// <summary> /// Implements the <see cref="IWindsorInstaller"/> interface to /// performs the installation in the <see cref="IWindsorContainer"/> /// (performed automatically when Castle scans the containing assembly). /// </summary> /// <param name="container"></param> /// <param name="store"></param> public void Install(IWindsorContainer container, IConfigurationStore store) { try { string fullPath = System.Reflection.Assembly.GetAssembly(typeof(Installers)).Location; string dir = System.IO.Path.GetDirectoryName(fullPath); // Do a Build Solution/Rebuild Solution to ensure that all modules have been build // if you are running into this assertion being raised. You should do: // Solution > Clean Solution // Solution > Rebuild Solution to fix this issue Debug.Assert(System.IO.File.Exists(System.IO.Path.Combine(dir, "Output.dll"))); container.Install(FromAssembly.Named(System.IO.Path.Combine(dir, "Output.dll"))); container.Install(FromAssembly.Named(System.IO.Path.Combine(dir, "Files.dll"))); container.Install(FromAssembly.Named(System.IO.Path.Combine(dir, "Edi.Documents.dll"))); container.Install(FromAssembly.Named(System.IO.Path.Combine(dir, @"Plugins\Log4NetTools\Log4NetTools.dll"))); } catch (Exception exp) { Debug.WriteLine("A Core loader error occurred {0}", exp.Message); Debug.WriteLine("Stacktrace {0}", exp.StackTrace); Logger.Error(exp); } // Register shell to have a MainWindow to start up with container .Register(Component.For <Edi.Apps.IShell <MainWindow> >() .ImplementedBy <Edi.Apps.Shell>().LifestyleTransient()); // Register MainWindow to help castle satisfy Shell dependencies on it container.Register(Component.For <MainWindow>().LifestyleTransient()); }
/// <summary> /// Installs the core modules of this application into <see cref="IWindsorContainer"/> /// and returns it to continue initialization/start-up using the core modules. /// </summary> /// <param name="container"></param> internal static void InstallWindsorCore(IWindsorContainer container) { // Register Messagebox service to help castle satisfy dependencies on it container .Register(Component.For <IMessageBoxService>() .ImplementedBy <MessageBoxService>().LifestyleSingleton()); try { string fullPath = System.Reflection.Assembly.GetAssembly(typeof(Installers)).Location; string dir = System.IO.Path.GetDirectoryName(fullPath); container.Install(FromAssembly.Named(System.IO.Path.Combine(dir, "Edi.Core.dll"))); container.Install(FromAssembly.Named(System.IO.Path.Combine(dir, "Edi.Themes.dll"))); container.Install(FromAssembly.Named(System.IO.Path.Combine(dir, "Edi.Settings.dll"))); } catch (Exception exp) { Logger.Error(exp); } container.Register(Component.For <IMRUListViewModel>().Instance(MRULib.MRU_Service.Create_List()).LifestyleSingleton()); container .Register(Component.For <IAvalonDockLayoutViewModel>() .ImplementedBy <AvalonDockLayoutViewModel>().LifestyleSingleton()); container .Register(Component.For <IDocumentTypeManager>() .ImplementedBy <DocumentTypeManager>().LifestyleSingleton()); container .Register(Component.For <IFileOpenService, IApplicationViewModel>() .ImplementedBy <ApplicationViewModel>().LifestyleSingleton()); }
private async void Application_Startup(object sender, StartupEventArgs e) { _container = new WindsorContainer(); // Disable property injection var propInjector = _container.Kernel.ComponentModelBuilder .Contributors .OfType <PropertiesDependenciesModelInspector>() .Single(); _container.Kernel.ComponentModelBuilder.RemoveContributor(propInjector); _container.AddFacility <TypedFactoryFacility>(); _container.Install(FromAssembly.InThisApplication()); _container.Install(FromAssembly.Named("Filtration.Parser")); // Not directly referenced so manually call its installers mapper = new MapperConfiguration(cfg => { cfg.ConstructServicesUsing(_container.Resolve); cfg.CreateMap <Theme, IThemeEditorViewModel>().ConstructUsingServiceLocator(); cfg.CreateMap <ThemeComponent, ThemeComponentViewModel>().ReverseMap(); cfg.CreateMap <ColorThemeComponent, ColorThemeComponentViewModel>().ReverseMap(); cfg.CreateMap <IntegerThemeComponent, IntegerThemeComponentViewModel>().ReverseMap(); cfg.CreateMap <StrIntThemeComponent, StrIntThemeComponentViewModel>().ReverseMap(); cfg.CreateMap <StringThemeComponent, StringThemeComponentViewModel>().ReverseMap(); cfg.CreateMap <IconThemeComponent, IconThemeComponentViewModel>().ReverseMap(); cfg.CreateMap <EffectColorThemeComponent, EffectColorThemeComponentViewModel>().ReverseMap(); cfg.CreateMap <ThemeEditorViewModel, Theme>(); }); mapper.AssertConfigurationIsValid(); var bootstrapper = _container.Resolve <IBootstrapper>(); await bootstrapper.GoAsync(); }
static void Main(string[] args) { var container = StaticWindsorContainer.Container; container.Install( FromAssembly.This(), FromAssembly.Named("Tasker.AL"), FromAssembly.Named("Tasker.BL"), FromAssembly.Named("Tasker.Data") ); var service = container.Resolve <MyService>(); if (!Environment.UserInteractive) { var servicesToRun = new ServiceBase[] { service }; ServiceBase.Run(servicesToRun); } else { service.Start(); Console.ReadLine(); } }
/// <summary> /// Performs the installation in the Castle.Windsor.IWindsorContainer. /// </summary> /// <param name="container"></param> /// <param name="store"></param> public void Install(IWindsorContainer container, IConfigurationStore store) { try { string fullPath = System.Reflection.Assembly.GetAssembly(typeof(Installers)).Location; string dir = System.IO.Path.GetDirectoryName(fullPath); // register components in this DLL and make them available here container.Install(FromAssembly.Named(System.IO.Path.Combine(dir, "Settings.dll"))); container.Install(FromAssembly.Named(System.IO.Path.Combine(dir, "XmlExplorerVMLib.dll"))); } catch (Exception exp) { Logger.Error(exp); } container.Register(Component.For <IAppearanceManager>() .Instance(AppearanceManager.GetInstance()).LifestyleSingleton()); // Register settings service component to help castle satisfy dependencies on it container .Register(Component.For <IAppLifeCycleViewModel>() .ImplementedBy <AppLifeCycleViewModel>().LifestyleSingleton()); // Register settings service component to help castle satisfy dependencies on it container .Register(Component.For <IThemesManagerViewModel>() .ImplementedBy <ThemesManagerViewModel>().LifestyleSingleton()); // Register application viewmodel to help castle satisfy dependencies on it container .Register(Component.For <IAppViewModel>() .ImplementedBy <AppViewModel>().LifestyleSingleton()); }
public void Install(IWindsorContainer container, IConfigurationStore store) { var installerFactory = new WindsorInstallerFactory <AutoInstallAttribute>(); var filteredAssemblies = AssemblyUtility.RelatedAssemblies .Select(x => FromAssembly.Named(x, installerFactory)).ToArray(); container.Install(filteredAssemblies); }
public Bootstrapper Setup() { Locator.SetLocator(new CastleWindsorDependencyResolver(this.container)); Locator.CurrentMutable.InitializeSplat(); Locator.CurrentMutable.InitializeReactiveUI(); this.container.Install(FromAssembly.Named("ReactiveUiCastleWindsorAdapter")); return(this); }
private void Application_Startup(object sender, StartupEventArgs e) { DispatcherUnhandledException += OnDispatcherUnhandledException; _container = new WindsorContainer(); // Disable property injection var propInjector = _container.Kernel.ComponentModelBuilder .Contributors .OfType <PropertiesDependenciesModelInspector>() .Single(); _container.Kernel.ComponentModelBuilder.RemoveContributor(propInjector); _container.AddFacility <TypedFactoryFacility>(); _container.Install(FromAssembly.InThisApplication()); _container.Install(FromAssembly.Named("Filtration.Parser")); // Not directly referenced so manually call its installers Mapper.Configuration.ConstructServicesUsing(_container.Resolve); Mapper.CreateMap <ItemFilterBlockGroup, ItemFilterBlockGroupViewModel>() .ForMember(destination => destination.ChildGroups, options => options.ResolveUsing( delegate(ResolutionResult resolutionResult) { var context = resolutionResult.Context; var showAdvanced = (bool)context.Options.Items["showAdvanced"]; var group = (ItemFilterBlockGroup)context.SourceValue; if (showAdvanced) { return(group.ChildGroups); } else { return(group.ChildGroups.Where(c => c.Advanced == false)); } })) .ForMember(dest => dest.SourceBlockGroup, opts => opts.MapFrom(from => from)) .ForMember(dest => dest.IsExpanded, opts => opts.UseValue(false)); Mapper.CreateMap <Theme, IThemeEditorViewModel>().ConstructUsingServiceLocator(); Mapper.CreateMap <ThemeComponent, ThemeComponentViewModel>().ReverseMap(); Mapper.CreateMap <IThemeEditorViewModel, Theme>(); Mapper.AssertConfigurationIsValid(); var mainWindow = _container.Resolve <IMainWindow>(); mainWindow.Show(); var updateCheckService = _container.Resolve <IUpdateCheckService>(); updateCheckService.CheckForUpdates(); }
public IWindsorContainer BootstrapContainer() { var container = new WindsorContainer(); // Install from this assembly first to register service overrides container.Install(FromAssembly.This()); container.Install(FromAssembly.Named("Database.Core")); return(container); }
private static void BootstrapContainer() { container = new WindsorContainer() .Install(FromAssembly.This(), FromAssembly.Named("Data.NHibernate"), FromAssembly.Named("Services")); var controllerFactory = new WindsorControllerFactory(container.Kernel); ControllerBuilder.Current.SetControllerFactory(controllerFactory); }
static void Main(string[] args) { var castle = new WindsorContainer(); castle.Install(FromAssembly.Named("configuration.example.Configuration")); var configurationbuilder = castle.Resolve <IConfigurationBuilder>(); var config = configurationbuilder.Build(); Console.WriteLine(config["app"]); }
public static IWindsorContainer BootstrapContainer() { return(new WindsorContainer() .Install(FromAssembly.This()) .Install(FromAssembly.Named("Wafer.Utils")) .Install(FromAssembly.Named("Wafer.Core")) .Install(FromAssembly.Named("Wafer.UI")) .Install(FromAssembly.Named("Wafer.UI.Direct2D")) .Install(FromAssembly.Named("Wafer.StatusBar"))); }
public static void Register(HttpConfiguration httpConfiguration, out IWindsorContainer container) { container = new WindsorContainer().Install(FromAssembly.This(), FromAssembly.Named("SingleSignOn.Core")); var controllerFactory = new WindsorControllerFactory(container.Kernel); ControllerBuilder.Current.SetControllerFactory(controllerFactory); GlobalConfiguration.Configuration.Services.Replace(typeof(IHttpControllerActivator), new WindsorCompositionRoot(container)); }
public void Install(IWindsorContainer container, IConfigurationStore store) { container.Register(Component.For <V8ScriptEngine>().LifestyleSingleton()); container.Install(FromAssembly.Named("XFAForms.FormEngine")); container.Register(Component.For <FormEngine.FormEngine>().LifestylePerWebRequest()); container.Register(Component.For <FormsController>().LifestylePerWebRequest()); }
public bool Start(HostControl hostControl) { _container = new WindsorContainer(); _container.Register(Component.For <IWindsorContainer>().Instance(_container)); _container.AddFacility <StartableFacility>(f => f.DeferredTryStart()); _container.Install(FromAssembly.Named("FDP.Infrastructure")); //Start comsuming messages only after everything else is registed and started _container.Register(Classes.FromAssemblyNamed("FDP.Subscribers") .BasedOn <IStartable>()); return(true); }
static void Main(string[] args) { Console.WriteLine("JobManager Database Initializer\nAvailable commands:\n0 - delete all data from database\n1 - fill database with test data\n2 - exit"); var iocContainer = new WindsorContainer().Install( FromAssembly.Named("JobManager.Data")); iocContainer.Register(Component.For <DbWorker>()); var worker = iocContainer.Resolve <DbWorker>(); while (true) { Console.Write(">"); string cmd = Console.ReadLine(); int command; bool exit = false; if (Int32.TryParse(cmd, out command)) { switch (command) { case 0: if (!worker.DeleteAllDataFromDb()) { Console.WriteLine("data hasn't been deleted"); } break; case 1: if (worker.DeleteAllDataFromDb()) { worker.FillDbWithTestData(); } else { Console.WriteLine("data hasn't been deleted"); } break; case 2: exit = true; break; default: break; } } if (exit) { break; } } }
private void Application_Startup(object sender, StartupEventArgs e) { _container = new WindsorContainer(); _container.AddFacility <TypedFactoryFacility>(); _container.Install(FromAssembly.InThisApplication()); _container.Install(FromAssembly.Named("Filtration.Parser")); var mainWindow = _container.Resolve <IMainWindow>(); mainWindow.Show(); }
private static void BootstrapContainer() { container = new WindsorContainer(); container.AddFacility("transactionmanagement", new TransactionFacility()); container.Install(Configuration.FromAppConfig()); container.Install(FromAssembly.Named("com.Sconit.Persistence")); container.Install(FromAssembly.Named("com.Sconit.Service")); container.Install(FromAssembly.This()); var controllerFactory = new WindsorControllerFactory(container); ControllerBuilder.Current.SetControllerFactory(controllerFactory); }
private void Application_Startup(object sender, StartupEventArgs e) { _container = new WindsorContainer(); _container.Install( FromAssembly.This(), FromAssembly.Named("Chip8Emulator.Core") ); var mainWindow = _container.Resolve <IMainWindow>(); mainWindow.Show(); }
// This method gets called by the runtime. Use this method to add services to the container. public IServiceProvider ConfigureServices(IServiceCollection services) { // Setup component model contributors for making windsor services available to IServiceProvider Container.AddFacility <AspNetCoreFacility>(f => f.CrossWiresInto(services)); services.AddMvc().SetCompatibilityVersion(CompatibilityVersion.Version_2_1); Container.Install(FromAssembly.Named("configuration.example.Configuration")); Configuration = Container.Resolve <IConfigurationBuilder>() .AddJsonFile($"appsettings.{Environment.GetEnvironmentVariable("ENV")}.json") .AddEnvironmentVariables() .Build(); Container.Register(Component.For <IConfiguration>().Instance(Configuration)); return(services.AddWindsor(Container)); }
public static void ConfigureWindsor(HttpConfiguration configuration) { _container = new WindsorContainer(); _container.Install(FromAssembly.This()); _container.Install(FromAssembly.Named("Cherries.Services.Bootstrapper")); _container.Install(FromAssembly.Named("TFI.BusinessLogic.Bootstraper")); _container.Kernel.Resolver.AddSubResolver(new CollectionResolver(_container.Kernel, true)); var dependencyResolver = new WindsorDependencyResolver(_container); configuration.DependencyResolver = dependencyResolver; GlobalHost.DependencyResolver = new SignalrWindsorDependencyResolver(_container); }
protected override void Configure() { container .Kernel .Resolver .AddSubResolver(new CollectionResolver(container.Kernel)); container .AddFacility <TypedFactoryFacility>() .AddFacility <EventAggregatorFacility>() .Install(FromAssembly.Named("ClipboardMachinery.Core")) .Install(FromAssembly.This()); logger = container.Resolve <ILogger>(); }
private void ConfigWindsor(IAppBuilder app) { var windsorConfigPath = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "windsor.config"); app.UseWindsorContainer(windsorConfigPath); var container = app.GetWindsorContainer(); container.Install( FromAssembly.Named("Beginor.OwinApp.Data"), FromAssembly.Named("Beginor.OwinApp.Model"), FromAssembly.Named("Beginor.OwinApp.Logic"), FromAssembly.Named("Beginor.OwinApp.Security"), FromAssembly.Named("Beginor.OwinApp.Api") ); app.UseWindsorMiddleWare(); }
public void Setup() { Container = new WindsorContainer() .Install(FromAssembly.This(), FromAssembly.Named("SeoAnalyzer.Core") ); var assemblies = new List <Assembly> { Assembly.GetExecutingAssembly() }; var relatedAssemblies = Assembly.GetExecutingAssembly().GetReferencedAssemblies().Where(x => x.Name.StartsWith("SeoAnalyzer.")); assemblies.AddRange(relatedAssemblies.Select(Assembly.Load)); }
//how to get the assembly name ? // http://inoteitdown.blogspot.com/2011/07/get-assembly-fully-qualified-name.html public IWindsorContainer bootstrapContainer() { return(Container .Install( //new iControllerInstallers(), //new iRepoInstallers(), //Configuration.FromAppConfig(), FromAssembly.This(), FromAssembly.Named("DataAccess_RedisCache_RepositoryAccess, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null"), FromAssembly.Named("DataAccessEFGenericRepo, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null"), FromAssembly.Named("DTOMappingLayer, Version = 1.0.0.0, Culture = neutral, PublicKeyToken = null") //FromAssembly.Named("BusinessLogicValidationLayer"), //FromAssembly.Named("BusinessLogicServicesLayer"), //FromAssembly.Named("DataAccessEFGenericRepo") )); }