What is the purpose and usings of shared services in prism ?
What things can make me think that I have to use shared services instead of EventAggegator
?
Looking at EventAggregator
from an event subscriber point of view, it's good for getting notified about certain events that occur in the application. This way you're performing an operation passively, i.e. whenever someone else publishes an event. You'd like to use EventAggregator
when you need to react to something happening in your application.
On the other hand, with shared services you can actively perform operations and request data. For example, you could have a shared service that exposes a GetData()
method, and you could resolve this service and ask for the data actively, any time you need it.