Omri Btian
Omri Btian

Reputation: 6547

EventAggregation Pattern in backend systems

I want to take advantage of the powerful EventAggregator pattern for non-WPF backend systems written in C#.

A. Is that even a good idea? Is there a specific reason why this is implemented mostly by frontend frameworks?

B. If it is, does anyone know a framework (Not Prism obviously) that supports that or can provide some kind of skeleton I can work with?

Upvotes: 1

Views: 136

Answers (2)

Omri Btian
Omri Btian

Reputation: 6547

Thanks to the breaking down of the Prism, I was able to only use the PubSubEvents library. All I had to do is to add a MEF wrapper class with Export and PartCreationPolicy attributes

[Export(typeof(IEventAggregator))]
[PartCreationPolicy(CreationPolicy.Shared)]
public class MefEventAggregator : EventAggregator
{
}

Upvotes: 0

EngineerSpock
EngineerSpock

Reputation: 2675

EventAggregator is a general-purpose pattern. It is an abstracted static bus for publishing events and subscribing for them. Nothing else, in essense. There is no restrictions on using it for frontends only.

You can find an implementation of that pattern in Caliburn.Micro framework, for example.

One more point. Consider that sometimes it occurs that EventAggregator hides dependencies of objects. It's up to you to decide whether it is a good idea, or not.

Upvotes: 2

Related Questions