Пример #1
0
 private void RegisterDeletedChanges(IWindsorContainer container)
 {
     container.Register(
         Component
         .For <IGetDeletedResourceIds>()
         .ImplementedBy <GetDeletedResourceIds>());
 }
Пример #2
0
 private void RegisterIAvailableChangeEventsProvider(IWindsorContainer container)
 {
     container.Register(
         Component
         .For <IAvailableChangeVersionProvider>()
         .ImplementedBy <AvailableChangeVersionProvider>());
 }
Пример #3
0
 private void RegisterNHibernateConfigurationActivities(IWindsorContainer container)
 {
     container.Register(
         Component
         .For <INHibernateBeforeBindMappingActivity>()
         .ImplementedBy <ChangeQueryMappingNHibernateConfigurationActivity>());
 }
Пример #4
0
        public void Install(IWindsorContainer container, IConfigurationStore store)
        {
            //container.Install(FromAssembly.This());

            container.Register(Classes.FromThisAssembly()
                               .BasedOn <IHttpController>()
                               .LifestylePerWebRequest());

            container.Register(Classes.FromThisAssembly()
                               .BasedOn <IRepository>().LifestyleTransient());

            container.Register(Component.For <WebApiValidatorFactory>().ImplementedBy <WebApiValidatorFactory>().DependsOn(container));
            container.Register(Component.For <ISerialiseMessage <PurchaseOrderType> >().ImplementedBy <SerialiseXmlMessage>());
            container.Register(Component.For <ISerialiseMessage <USAddress> >().ImplementedBy <SerialiseXmlMessageUSAddress>());

            container.Register(Classes.FromThisAssembly().BasedOn(typeof(AbstractValidator <>)).WithServiceBase());

            //container.Register(Component.For<ValidationFilter>().LifestyleTransient());
            container.Register(Classes.FromThisAssembly().BasedOn(typeof(ActionFilterAttribute)).LifestyleTransient());

            //container.Register(Component.For<IFilterProvider>().ImplementedBy<ConfigurableFilterProvider>());

            //container.Register(Component.For<IHttpControllerActivator>()
            //    .ImplementedBy<CompositionRoot>()
            //    .LifestyleTransient());

            //container.Register(Component.For(typeof(AbstractValidator<PurchaseOrderType>))
            //    .UsingFactoryMethod((kernel, cmModel, ctx) =>
            //        kernel.Resolve<WebApiValidatorFactory>().CreateInstance(ctx.RequestedType)));
            //.UsingFactory((WebApiValidatorFactory fac) =>
            //fac.CreateInstance(typeof(AbstractValidator<>))))
            ;
        }
Пример #5
0
Файл: Program.cs Проект: lgnv/di
        public static WindsorContainer BuildContainer(string[] args)
        {
            var container = new WindsorContainer();

            container.Kernel.Resolver.AddSubResolver(new ArrayResolver(container.Kernel, false));
            container.Register(Component.For <IUi>()
                               .ImplementedBy <ConsoleUi>());
            container.Register(
                Component.For <IReader>().ImplementedBy <TxtReader>(),
                Component.For <IReader>().ImplementedBy <DocReader>());
            container.Register(Component.For <ILayoutAlgorithm>()
                               .ImplementedBy <CircularCloudLayouter>()
                               .DependsOn(Dependency.OnValue("center", new Point(500, 500))));
            container.Register(Component.For <IImageBuilder>()
                               .ImplementedBy <TagCloudImageBuilder>());
            container.Register(Component.For <IColoringAlgorithm>()
                               .ImplementedBy <RandomColoring>());
            container.Register(Component.For <IWordFilter>().ImplementedBy <BoringWordsFilter>());
            container.Register(
                Component.For <IWordConverter>().ImplementedBy <LowerCaseConverter>(),
                Component.For <IWordConverter>().ImplementedBy <PunctuationRemover>());
            container.Register(Component.For <IImageSaver>()
                               .ImplementedBy <ImageSaver>());
            container.Register(Component.For <Filter>()
                               .LifestyleSingleton());
            container.Register(Component.For <WordConverter>()
                               .LifestyleSingleton());
            return(container);
        }
Пример #6
0
        private static void InitializeWindsor()
        {
            container.Install(FromAssembly.This());

            container.Register(WComponent.For <IInterceptor>().ImplementedBy <ALInterceptor3>().LifestyleTransient(),
                               WComponent.For <IInterceptor>().ImplementedBy <ALInterceptor2>().LifestyleTransient(),

                               Types.FromAssemblyNamed("AL").BasedOn <BaseClass>().WithServiceAllInterfaces()
                               .Configure(f => f.Interceptors <ALInterceptor3>().LifestyleTransient()),
                               Types.FromAssemblyNamed("AL").BasedOn <ServiceBase>().WithServiceAllInterfaces()
                               .Configure(f => f.Interceptors <ALInterceptor2>().LifestyleTransient()),

                               Classes.FromAssemblyNamed("AL").Pick().WithServiceAllInterfaces().LifestyleTransient()
                               );
            //container.Register(Types.FromAssemblyNamed("AL").BasedOn<BaseClass>().WithServiceAllInterfaces()
            //    .Configure(f => f.Interceptors<ALInterceptor3>().LifestyleTransient()));
            //container.Register(Classes.FromAssemblyNamed("AL").Pick().WithServiceAllInterfaces().LifestyleTransient());


            //container.Register(WComponent.For<IInterceptor>().ImplementedBy<ALInterceptor3>().LifestyleTransient());
            //container.Register(Types.FromAssemblyNamed("AL").BasedOn<BaseClass>().WithServiceAllInterfaces()
            //    .Configure(f => f.Interceptors<ALInterceptor3>().LifestyleTransient()));
            //container.Register(Classes.FromAssemblyNamed("AL").Pick().WithServiceAllInterfaces().LifestyleTransient());

            //container.Register(WComponent.For<IClass1Interface>().ImplementedBy<Class1>().LifestyleTransient());
            //container.Register(WComponent.For<IClass2Interface>().ImplementedBy<Class2>().LifestyleTransient());
            //container.Register(WComponent.For<IClass3Interface>().ImplementedBy<Class3>().LifestyleTransient());
        }
 private void RegisterSpecialFactories(IWindsorContainer container)
 {
     container.Register(Component.For <ICodePaneHandler>()
                        .ImplementedBy <CodePaneSourceCodeHandler>()
                        .LifestyleSingleton());
     container.Register(Component.For <IFileSystemBrowserFactory>()
                        .ImplementedBy <DialogFactory>()
                        .LifestyleSingleton());
     container.Register(Component.For <IModuleRewriterFactory>()
                        .ImplementedBy <ModuleRewriterFactory>()
                        .DependsOn(Dependency.OnComponent("codePaneSourceCodeHandler", typeof(CodePaneSourceCodeHandler)),
                                   Dependency.OnComponent("attributesSourceCodeHandler", typeof(SourceFileHandlerSourceCodeHandlerAdapter)))
                        .LifestyleSingleton());
     container.Register(Component.For <IRubberduckParserErrorListenerFactory>()
                        .ImplementedBy <ExceptionErrorListenerFactory>()
                        .LifestyleSingleton());
     container.Register(Component.For <IParsePassErrorListenerFactory>()
                        .ImplementedBy <MainParseErrorListenerFactory>()
                        .LifestyleSingleton());
     container.Register(Component.For <PreprocessingParseErrorListenerFactory>()
                        .ImplementedBy <PreprocessingParseErrorListenerFactory>()
                        .LifestyleSingleton());
     container.Register(Component.For <IRewriteSessionFactory>()
                        .ImplementedBy <RewriteSessionFactory>()
                        .LifestyleSingleton());
     container.Register(Component.For <IAddRemoveReferencesPresenterFactory>()
                        .ImplementedBy <AddRemoveReferencesPresenterFactory>()
                        .LifestyleSingleton());
 }
Пример #8
0
        public RoomContext(CampfireApiFake campfireApiFake)
        {
            var bootstrapper = new Bootstrapper {
                TestMode = true
            };

            _container = bootstrapper.Container;
            _container.Kernel.ComponentCreated += KernelOnComponentCreated;

            _campfireApiFake = campfireApiFake;
            _container.Register(Component.For <ICampfireApi>().Instance(_campfireApiFake));

            _loader = new MockSettingsLoader();
            _container.Register(Component.For <ISettingsLoader>().Instance(_loader));

            _container.Register(Component.For <Func <NotificationAction, INotificationAction> >().Instance(CreateNotificationAction));

            _container.Register(
                Component.For <IApplicationActivator>().Instance(
                    (ApplicationActivatorMock = new Mock <IApplicationActivator>()).Object));

            _fakeClipboardService = new FakeClipBoardService();
            _container.Register(Component.For <IClipboardService>().Instance(_fakeClipboardService));

            _container.Register(Component.For <IPasteView>().ImplementedBy <FakePasteView>().LifestyleTransient());

            bootstrapper.Bootstrap();



            _container.Install(FromAssembly.This());

            _bus = _container.Resolve <IMessageBus>();


            Listen <RequestRecentMessagesMessage>();

            _bus.SendMessage(new ApplicationLoadedMessage());

            object dummy = _container.Resolve <IToastWindow>();

            dummy = _container.Resolve <ISettingsViewModel>();



            _componentCounts = new Dictionary <Type, int>();
            _container.Kernel.ComponentCreated += (model, instance) =>
            {
                int count = 0;
                _componentCounts.TryGetValue(instance.GetType(), out count);
                count++;
                _componentCounts[instance.GetType()] = count;
            };
            _container.Kernel.ComponentDestroyed += (model, instance) =>
            {
                int count = _componentCounts[instance.GetType()];
                count--;
                _componentCounts[instance.GetType()] = count;
            };
        }
Пример #9
0
 private static void RegisterRubberduckCommandBar(IWindsorContainer container)
 {
     container.Register(Component.For <RubberduckCommandBar>()
                        .LifestyleTransient()
                        .DependsOn(Dependency.OnComponentCollection <IEnumerable <ICommandMenuItem> >(RubberduckCommandBarItems()))
                        .OnCreate((kernel, item) => item.Parent = kernel.Resolve <ICommandBars>()));
 }
Пример #10
0
        // note: settings namespace classes are injected in singleton scope
        private void RegisterConfiguration(IWindsorContainer container, Assembly[] assembliesToRegister)
        {
            foreach (var assembly in assembliesToRegister)
            {
                container.Register(Classes.FromAssembly(assembly)
                                   .InSameNamespaceAs <Configuration>()
                                   .WithService.AllInterfaces()
                                   .LifestyleSingleton());
            }

            container.Register(Component.For <IPersistable <SerializableProject> >()
                               .ImplementedBy <XmlPersistableDeclarations>()
                               .LifestyleTransient());

            container.Register(Component.For(typeof(IPersistanceService <>), typeof(IFilePersistanceService <>))
                               .ImplementedBy(typeof(XmlPersistanceService <>))
                               .LifestyleSingleton());

            container.Register(Component.For <IConfigProvider <IndenterSettings> >()
                               .ImplementedBy <IndenterConfigProvider>()
                               .LifestyleSingleton());
            container.Register(Component.For <IConfigProvider <SourceControlSettings> >()
                               .ImplementedBy <SourceControlConfigProvider>()
                               .LifestyleSingleton());

            container.Register(Component.For <ISourceControlSettings>()
                               .ImplementedBy <SourceControlSettings>()
                               .LifestyleTransient());
        }
Пример #11
0
 private static void RegisterParentMenu <TParentMenu>(IWindsorContainer container, Type[] menuItemTypes) where TParentMenu : IParentMenuItem
 {
     container.Register(Component.For <IMenuItem, TParentMenu>()
                        .ImplementedBy <TParentMenu>()
                        .LifestyleTransient()
                        .DependsOn(Dependency.OnComponentCollection <IEnumerable <IMenuItem> >(menuItemTypes)));
 }
Пример #12
0
        public void Init()
        {
            try
            {
                CoreContainer.SetUp(new WindsorContainer());
                CoreContainer.Container.Register(Component.For <IIranMarketerDatabase>().ImplementedBy <IranMarketerDatabase>());
                CoreContainer.Container.Register(Component.For <ISession>().ImplementedBy <IranMarketerSession>());
                FromAssemblyDescriptor fromAssemblyInDirectoryUserManagement = Classes.FromAssemblyInDirectory(new AssemblyFilter(PathHelper.BinPath(), "*.UserManagement.dll"));
                CoreContainer.Container.Register(fromAssemblyInDirectoryUserManagement.BasedOn(typeof(IService <,>)).WithService.DefaultInterfaces());
                CoreContainer.Container.Register(fromAssemblyInDirectoryUserManagement.BasedOn(typeof(IRepository <,>)).WithService.AllInterfaces());
                CoreContainer.Container.Register(fromAssemblyInDirectoryUserManagement.BasedOn(typeof(BaseMapper <>)).WithServiceBase().WithServiceSelf().LifestyleTransient());

                FromAssemblyDescriptor fromAssemblyInDirectoryApi = Classes.FromAssemblyInDirectory(new AssemblyFilter(PathHelper.BinPath(), "*.API.dll"));
                CoreContainer.Container.Register(fromAssemblyInDirectoryApi.BasedOn(typeof(AbstractProvider <, ,>)).WithService.AllInterfaces().WithServiceBase().WithServiceSelf().LifestyleTransient());


                FromAssemblyDescriptor fromAssemblyInDirectoryApiBasic = Classes.FromAssemblyInDirectory(new AssemblyFilter(PathHelper.BinPath(), "*.API.dll"));
                CoreContainer.Container.Register(fromAssemblyInDirectoryApi.BasedOn(typeof(BaseProvider)).WithService.AllInterfaces().WithServiceBase().WithServiceSelf().LifestyleTransient());

                FromAssemblyDescriptor fromAssemblyInDirectorySetting = Classes.FromAssemblyInDirectory(new AssemblyFilter(PathHelper.BinPath(), "*.Service.dll"));
                CoreContainer.Container.Register(fromAssemblyInDirectorySetting.BasedOn(typeof(BaseSettingService)).WithService.AllInterfaces().WithServiceBase().WithServiceSelf().LifestyleTransient());
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
        // note: settings namespace classes are injected in singleton scope
        private void RegisterConfiguration(IWindsorContainer container, Assembly[] assembliesToRegister)
        {
            var experimentalTypes = new List <Type>();

            foreach (var assembly in assembliesToRegister)
            {
                container.Register(Classes.FromAssembly(assembly)
                                   .IncludeNonPublicTypes()
                                   .Where(type => type.Namespace == typeof(Configuration).Namespace && type.NotDisabledOrExperimental(_initialSettings))
                                   .WithService.AllInterfaces()
                                   .LifestyleSingleton());

                experimentalTypes.AddRange(assembly.GetTypes()
                                           .Where(t => Attribute.IsDefined(t, typeof(ExperimentalAttribute))));
            }

            // FIXME correctly register experimentalFeatureTypes.
            // This is probably blocked until GeneralSettingsViewModel is no more newed up in SettingsForm's code-behind
            //container.Register(Component.For(typeof(IEnumerable<Type>))
            //    .DependsOn(Dependency.OnComponent<ViewModelBase, GeneralSettingsViewModel>())
            //    .LifestyleSingleton()
            //    .Instance(experimentalTypes));

            container.Register(Component.For <IComProjectSerializationProvider>()
                               .ImplementedBy <XmlComProjectSerializer>()
                               .LifestyleTransient());
            container.Register(Component.For(typeof(IPersistanceService <>), typeof(IFilePersistanceService <>))
                               .ImplementedBy(typeof(XmlPersistanceService <>))
                               .LifestyleSingleton());

            container.Register(Component.For <IConfigProvider <IndenterSettings> >()
                               .ImplementedBy <IndenterConfigProvider>()
                               .LifestyleSingleton());
        }
Пример #14
0
        /// <summary>
        /// Installs BLL IoC and Castle Windsor Controller factory
        /// </summary>
        private void InstallIoC()
        {
            Container = new WindsorContainer();
            Container.Install(new BLLInstaller());

            Container.Register(Component.For <IHttpControllerActivator>().Instance(new WindsorCompositionRoot(Container)));
            Container.Register(Classes.FromThisAssembly().BasedOn <IHttpController>().LifestyleTransient());
        }
Пример #15
0
        private void LegacyInit()
        {
            Kernel.Register(Component.For <FactoryInterceptor>().NamedAutomatically("typed.fac.interceptor"));

            var converter = Kernel.GetConversionManager();

            AddFactories(FacilityConfig, converter);
        }
Пример #16
0
 private static void RegisterRepositories()
 {
     Container.Register(Component.For <QueryContext>().LifestyleScoped());
     Container.Register(
         Component.For(typeof(IBaseRepository <>))
         .ImplementedBy(typeof(BaseRepository <>))
         .LifestyleScoped());
 }
Пример #17
0
 private void RegisterConstantVbeAndAddIn(IWindsorContainer container)
 {
     container.Register(Component.For <IVBE>().Instance(_vbe));
     container.Register(Component.For <IAddIn>().Instance(_addin));
     //note: This registration makes Castle Windsor inject _vbe_CommandBars in all ICommandBars Parent properties.
     container.Register(Component.For <ICommandBars>().Instance(_vbe.CommandBars));
     container.Register(Component.For <IUiContextProvider>().Instance(UiContextProvider.Instance()).LifestyleSingleton());
     container.Register(Component.For <IVBEEvents>().Instance(VBEEvents.Initialize(_vbe)).LifestyleSingleton());
 }
Пример #18
0
        private void RegisterWindowsHooks(IWindsorContainer container)
        {
            var mainWindowHwnd = (IntPtr)_vbe.MainWindow.HWnd;

            container.Register(Component.For <IRubberduckHooks>()
                               .ImplementedBy <RubberduckHooks>()
                               .DependsOn(Dependency.OnValue <IntPtr>(mainWindowHwnd))
                               .LifestyleSingleton());
        }
        private void RegisterParentMenu <TParentMenu>(IWindsorContainer container, Type[] menuItemTypes) where TParentMenu : IParentMenuItem
        {
            var nonExperimentalMenuItems = menuItemTypes.Where(type => type.NotDisabledOrExperimental(_initialSettings)).ToArray();

            container.Register(Component.For <IMenuItem, TParentMenu>()
                               .ImplementedBy <TParentMenu>()
                               .LifestyleTransient()
                               .DependsOn(Dependency.OnComponentCollection <IEnumerable <IMenuItem> >(nonExperimentalMenuItems)));
        }
Пример #20
0
 private void RegisterUnitTestingComSide(IWindsorContainer container)
 {
     container.Register(Component.For <IFakesFactory>()
                        .AsFactory()
                        .LifestyleSingleton());
     container.Register(Component.For <IFakes>()
                        .ImplementedBy <FakesProvider>()
                        .LifestyleTransient());
 }
Пример #21
0
 private static void RegisterSpecialFactories(IWindsorContainer container)
 {
     container.Register(Component.For <IFolderBrowserFactory>()
                        .ImplementedBy <DialogFactory>()
                        .LifestyleSingleton());
     container.Register(Component.For <IFakesProviderFactory>()
                        .ImplementedBy <FakesProviderFactory>()
                        .LifestyleSingleton());
 }
Пример #22
0
        private void RegisterCommandsWithPresenters(IWindsorContainer container)
        {
            if (_initialSettings.SourceControlEnabled)
            {
                container.Register(Component.For <CommandBase>()
                                   .ImplementedBy <SourceControlCommand>()
                                   .DependsOn(Dependency.OnComponent <IDockablePresenter, SourceControlDockablePresenter>())
                                   .LifestyleTransient()
                                   .Named(typeof(SourceControlCommand).Name));
                container.Register(Component.For <CommandBase>()
                                   .ImplementedBy <CommitCommand>()
                                   .DependsOn(Dependency.OnComponent <IDockablePresenter, SourceControlDockablePresenter>())
                                   .LifestyleTransient()
                                   .Named(typeof(CommitCommand).Name));
                container.Register(Component.For <CommandBase>()
                                   .ImplementedBy <UndoCommand>()
                                   .DependsOn(Dependency.OnComponent <IDockablePresenter, SourceControlDockablePresenter>())
                                   .LifestyleTransient()
                                   .Named(typeof(UndoCommand).Name));
            }

            container.Register(Component.For <CommandBase>()
                               .ImplementedBy <RunAllTestsCommand>()
                               .DependsOn(Dependency.OnComponent <IDockablePresenter, TestExplorerDockablePresenter>())
                               .LifestyleTransient()
                               .Named(typeof(RunAllTestsCommand).Name));
            container.Register(Component.For <CommandBase>()
                               .ImplementedBy <TestExplorerCommand>()
                               .DependsOn(Dependency.OnComponent <IDockablePresenter, TestExplorerDockablePresenter>())
                               .LifestyleTransient()
                               .Named(typeof(TestExplorerCommand).Name));

            container.Register(Component.For <CommandBase>()
                               .ImplementedBy <InspectionResultsCommand>()
                               .DependsOn(Dependency.OnComponent <IDockablePresenter, InspectionResultsDockablePresenter>())
                               .LifestyleTransient()
                               .Named(typeof(InspectionResultsCommand).Name));

            container.Register(Component.For <CommandBase>()
                               .ImplementedBy <CodeExplorerCommand>()
                               .DependsOn(Dependency.OnComponent <IDockablePresenter, CodeExplorerDockablePresenter>())
                               .LifestyleTransient()
                               .Named(typeof(CodeExplorerCommand).Name));

            container.Register(Component.For <CommandBase>()
                               .ImplementedBy <CodeMetricsCommand>()
                               .DependsOn(Dependency.OnComponent <IDockablePresenter, CodeMetricsDockablePresenter>())
                               .LifestyleSingleton()
                               .Named(typeof(CodeMetricsCommand).Name));

            container.Register(Component.For <CommandBase>()
                               .ImplementedBy <ToDoExplorerCommand>()
                               .DependsOn(Dependency.OnComponent <IDockablePresenter, ToDoExplorerDockablePresenter>())
                               .LifestyleTransient()
                               .Named(typeof(ToDoExplorerCommand).Name));
        }
Пример #23
0
 public void Install(IWindsorContainer container, IConfigurationStore store)
 {
     container.Register(Component.For <IApp>().ImplementedBy <App>().LifestyleSingleton());
     container.Register(Component.For <SerilogConfig>().ImplementedBy <SerilogConfig>().LifestyleSingleton());
     container.AddFacility <LoggingFacility>(f =>
                                             f.LogUsing(
                                                 new SerilogFactory(
                                                     new LoggerConfiguration().ReadFrom.Configuration(
                                                         container.Resolve <SerilogConfig>().GetConfiguration()).CreateLogger())));
 }
Пример #24
0
 private static void RegisterAppWithSpecialDependencies(IWindsorContainer container)
 {
     container.Register(Component.For <CommandBase>()
                        .ImplementedBy <VersionCheckCommand>()
                        .Named(nameof(VersionCheckCommand))
                        .LifestyleSingleton());
     container.Register(Component.For <App>()
                        .DependsOn(Dependency.OnComponent <CommandBase, VersionCheckCommand>())
                        .LifestyleSingleton());
 }
Пример #25
0
        private static void RegisterCodeExplorerViewModelWithCodeExplorerCommands(IWindsorContainer container)
        {
            var codeExplorerCommands = Assembly.GetExecutingAssembly().GetTypes()
                                       .Where(type => type.IsClass && type.Namespace != null &&
                                              type.CustomAttributes.Any(a => a.AttributeType == typeof(CodeExplorerCommandAttribute)));

            container.Register(Component.For <CodeExplorerViewModel>()
                               .DependsOn(Dependency.OnComponentCollection <List <CommandBase> >(codeExplorerCommands.ToArray()))
                               .LifestyleSingleton());
        }
Пример #26
0
        // protected LuceneThread luceneThread;

        #region IWindsorInstaller Members

        public void Install(IWindsorContainer container, IConfigurationStore store)
        {
            container.Register(
                AllTypes.FromThisAssembly().BasedOn <IController>().Configure(
                    c => c.LifeStyle.Transient.Named(c.Implementation.Name)),
                Component.For <IPlugin>().Instance(this).LifeStyle.Is(Castle.Core.LifestyleType.Singleton),
                Component.For <LuceneThread>().ImplementedBy <LuceneThread>().LifeStyle.Is(Castle.Core.LifestyleType.Singleton));

            this.container = container;
        }
Пример #27
0
 private static void RegisterMenu <TMenu>(IWindsorContainer container, ICommandBarControls controls, int beforeIndex, Type[] menuItemTypes) where TMenu : IParentMenuItem
 {
     container.Register(Component.For <IParentMenuItem>()
                        .ImplementedBy <TMenu>()
                        .LifestyleTransient()
                        .DependsOn(
                            Dependency.OnValue <int>(beforeIndex),
                            Dependency.OnComponentCollection <IEnumerable <IMenuItem> >(menuItemTypes))
                        .OnCreate((kernel, item) => item.Parent = controls));
 }
Пример #28
0
    public void Init(IWindsorContainer container)
    {
        container.Register(Component.For <IMessageSenderComponent>().ImplementedBy <MessageSenderComponent>().Interceptors(typeof(ComponentsInterceptor)));
        //container.Register(Component.For<IMessageSenderComponent>().ImplementedBy<MessageSenderComponent>());
        //container.Register(
        //    Component.For<IMessageSenderComponent>().ImplementedBy<MessageSenderComponent>().Interceptors(typeof(ProxyBaseInterceptor)));

        //2.yöntem
        //container.Register(
        //       Component.For<IMessageSenderComponent>().ImplementedBy<MessageSenderComponent>().Interceptors(InterceptorReference.ForType<ProxyBaseInterceptor>()).Anywhere);
    }
 public IRegistration Load(string key,
                           Type service,
                           IDictionary arguments)
 {
     return(Component.For(service)
            .Instance(Substitute.For(new[]
     {
         service
     },
                                     null)));
 }
        public static void RegisterDataAccess(this IWindsorContainer container, Assembly assembly)
        {
            Guard.AgainstNull(container, "container");

            container.Register(assembly, typeof(IDataRowMapper <>));
            container.Register(Component.For(typeof(IDataRepository <>)).ImplementedBy(typeof(DataRepository <>)));

            container.Register(assembly, "Repository");
            container.Register(assembly, "Query");
            container.Register(assembly, "Factory");
        }