Project Description
Provide implementation of a Mediator Pattern to facilitate decoupled object communication within an application. using .Net 4.5 async/await
In most projects I have worked on, at some point we need a decoupled mechanism for passing messages between objects, while there are a number of implementations of this type of pattern, typically as part of a larger framework (MVVMLight, Prism, historically even the MS CAB.) In several projects, and seemingly for political reasons, I was unable to utilize the existing frameworks and had to come up with my own.
I am currently between projects, and I thought I would take a stab at writing one for the OpenSource community that has been so helpful to me over the years. The difference between this mediator, and others I have used in the past is it completely implements the async/await functionality of .Net 4.5, and because of these new language features, I was able to implement some pretty cool (in my humble opinion) ways of interacting with the API.
I used the Portable Class Library Template, and targeted the .Net Framerork 4.5, Windows Phone 8, and .Net for Windows Store apps frameworks.
In designing the Mediator, I wanted to achieve several things:
1. It should work with WP8, WinRT, and .Net 4.5 apps
2. Subscribing to messages should be simple, and there should be several different ways to do it, including using anonymous functions, and custom attributes
3. Publishing messages should be equally simple.
4. Async operations should be supported throughout.
5. Bi-Directional support for published messages should be implemented. (With or without the need of a callback action)
Please check the documentation tab for some specific examples of how to use the various features.
I have included a test project that has several tests that demonstrate the basic functionality of the mediator, I am going to try and get WP8, Windows Store, and WPF app samples soon to offer more insight into the utilization of the mediator in a real world scenario.
Not Yet Implemented
I have not implemented an Unregister Method yet, so the subscribed sinks will continue to receive messages until they are dereferenced.