1
votes

I see Prism`s eventaggregator always and only used with GetEvent which is very odd. I am used to the old CAB event system - now using Mediator implementation from Marlon Grech - where I have defined string constants that way I do not have to create extra classes to fire/wrap my data if its a simple int or value type.

[MediatorMessageSink(MediatorMessages.AddSchoolclass, ParameterType = typeof(int))]
        public void OnSchoolclassAdded(int schoolclassId)
        {
            // do stuff with schoolclassId
        }

How can I do the same with the eventaggregator from Prismn

1
With CAB attribute approach, I can set the same method to subscribe to multiple different events. Wish Prism has this..Jeson Martajaya

1 Answers

0
votes

You could declare a single event class to use for all of your aggregate events, and pass a string as it's payload, but I wouldn't really recommend that approach. Prism developers would find it very confusing.

The Event Aggregator uses a different architecture than the old CAM. I wasn't happy either about the need for an event object when I made the change. But I've since been sold on the approach--the event object is basically a one-liner that I generate using a ReSharper template. The reason I like it so much is that it gives me a place to put any logic I might need to go along with the event.