I have 3 assemblies. Each one has EventHandlers. Only one assembly will 
work at the same time.
I have IEventBus and OnCreate method within component registration I 
register only the event handlers from the active assembly;

container.Register(Component.For<IEventBus>().ImplementedBy<InProcessEventBus>().OnCreate((kernel,
 eventBus) =>
            {
                (eventBus as 
InProcessEventBus).RegisterAllHandlersInAssembly(Assembly.GetAssembly(typeof(IHaveEventHandlers)),
 kernel.Resolve, kernel.ReleaseComponent);

                var loginProvider = container.Resolve<ILoginProvider>();

                if (loginProvider.LoginProviderType == 
LoginProvider.DB_LoginProvider) 
                    (eventBus as InProcessEventBus
).RegisterAllHandlersInAssembly(Assembly.GetAssembly(typeof(
IHaveDbLoginProviderEventHandlers)), kernel.Resolve, kernel.ReleaseComponent); 
                else if (loginProvider.LoginProviderType == 
LoginProvider.LDAP_LoginProvider) 
                    (eventBus as InProcessEventBus
).RegisterAllHandlersInAssembly(Assembly.GetAssembly(typeof(
IHaveLdapLoginProviderEventHandlers)), kernel.Resolve, 
kernel.ReleaseComponent); 
            }));

-- 
You received this message because you are subscribed to the Google Groups 
"Castle Project Users" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/castle-project-users/-/KJ2m6R77yHcJ.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/castle-project-users?hl=en.

Reply via email to