Created
November 22, 2012 13:30
-
-
Save codewithpassion/4131188 to your computer and use it in GitHub Desktop.
EventBrokerSubscriptionStrategy
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class EventBrokerSubscriptionStrategy : ActivationStrategy | |
{ | |
public override void Activate(IContext context, InstanceReference reference) | |
{ | |
reference.IfInstanceIs<IHandle>(messageHandler => Subscribe(messageHandler, context)); | |
} | |
private static void Subscribe(IHandle messageHandler, IContext context) | |
{ | |
IEventBrokerSubscriber eventBroker = context.Kernel.Get<IEventBrokerSubscriber>(); | |
eventBroker.Subscribe(messageHandler); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment