Developing on Staxmanade

NuGet Project Uncovered: EventAggregator.Net

If you are coming to this series of posts for the first time you might check out my introductory post for a little context.

NOTE: this project is one I created and as it turns out this has now become it’s introductory post.

EventAggregator.Net is a single C# file that can provide a basis for a simple in memory Pub/Sub event aggregator.

I extracted this out of my StatLight project as I found that I often wanted a similar one and kept finding myself copy/pasting this into projects. I figured a single location for this project would be better and I use StatLight as the first dog bowl when I need to dog food the project.

If you’re familiar with the…

Install-Package Caliburn.Micro.EventAggregator

…then you know probably know what this project is like.

Its history starts a few years ago when I read Jeremey Miller’s Braindump on Event Aggregator Pattern and decided I wanted rip out StatLight’s usage of the Prism event aggregator and replace it with a similar one to the one found in StoryTeller. It’s gone through quite a few revisions inside of StatLight since then and eventually made its way into its own project.

Some thanks have to go out to the great feedback and pull requests from Jake Ginnivan who found this project on his own (before I publicized it).

If you’re interested in using it, I’d recommend checking out the source’s test project and the SampleUsage project. The SampleUsage project demonstrates how you can configure the tool to publish events in an async mode.

One concept introduced in this EventAggregator is taking the IEventAggregator interface and breaking it up into two interfaces (IEventPublisher and IEventSubscriptionManager). This proved extremely useful when trying to diagnose components that did both aggregator subscription management vs ones that only published events. It even helped to easily diagnose components that did not correctly unregister objects.

Comments