Loosely coupled design with message coupling and event aggregation
Description
Event Aggregator aggregates events from multiple objects into itself, passing that same event onto its observers.
Simple
You can fire up any type of event.
App.xaml.cs
using System.Windows;
using EventAggregator;
namespace EventAggregatorSample
{
public partial class App : Application
{
protected override void OnStartup(StartupEventArgs e)
{
base.OnStartup(e);
Current.MainWindow = new MainWindow();
this.Send(EventId.Default.AppStartup);
}
}
}
Handle fired event whenever you need.
MainWindow.xaml.cs
using System.Windows;
using EventAggregator;
namespace EventAggregatorSample
{
public partial class MainWindow : Window
{
public MainWindow()
{
InitializeComponent();
this.Subscribe(EventId.Default.AppStartup, HandleAppStartup);
}
private void HandleAppStartup(EventMessage eventMessage)
{
Show();
}
}
}
It is simple and makes no couplings between modules.
Performance Test
It is very fast. You can see for yourself the performance test results for
Event Aggregator.
Single event processing takes
25-30 μs (
delivery time) no matter how many senders or subscribers you have!




More information can be found here at
Event Aggregator Performance Test Page.