Skip to content

Instantly share code, notes, and snippets.

@codewithpassion
Created November 22, 2012 13:30
Show Gist options
  • Save codewithpassion/4131188 to your computer and use it in GitHub Desktop.
Save codewithpassion/4131188 to your computer and use it in GitHub Desktop.
EventBrokerSubscriptionStrategy
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