Skip to content

Instantly share code, notes, and snippets.

@mhinze
Created October 22, 2009 21:00
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mhinze/216329 to your computer and use it in GitHub Desktop.
Save mhinze/216329 to your computer and use it in GitHub Desktop.
public static class DomainEvents
{
public static IContainer Container { get; set; }
public static IDomainEvent LastRaised { get; private set; }
public static void Raise<T>(T args) where T : IDomainEvent
{
if (Container != null)
foreach (var handler in Container.GetAllInstances<IHandler<T>>())
handler.Handle(args);
LastRaised = args;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment