Skip to content

Instantly share code, notes, and snippets.

@kkozmic
Created May 6, 2010 17:09
Show Gist options
  • Save kkozmic/392401 to your computer and use it in GitHub Desktop.
Save kkozmic/392401 to your computer and use it in GitHub Desktop.
Suggested fluent API for Windsor's EventWiringFacility
[Test]
public void Can_fluently_wire_events()
{
container.Register(Component.For<SimplePublisher>().PublishEvent("Event", "myUniqueEventId"),
Component.For<SimpleListener>().SubscribeEvent("myUniqueEventId", "OnEvent"));
var publisher = container.Resolve<SimplePublisher>();
var listener = container.Resolve<SimpleListener>();
Assert.IsFalse(listener.Listened);
publisher.Trigger();
Assert.IsTrue(listener.Listened);
Assert.AreSame(publisher, listener.Sender);
}
@hconceicao
Copy link

I have something similar for the stronghold internal projects, but I still not very satisfied with this approach (strings...).

Also, we'll need to do a heavy refactoring on the facility, to support the subscribe event approach.

@kkozmic
Copy link
Author

kkozmic commented May 6, 2010

Yes, I'm adding expression based API as well.
And I'm refactoring internals of the facility as well to support this decoupled structure. How do you use the facility Henry? You can send me an email if you don't want to discuss this in public. I could use some real scenario.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment