EventBroker and generics

Topics: CAB & Smart Client Software Factory
Aug 30, 2005 at 9:11 AM
originally posted by: Lagerblad

Knowing that the EventBroker is subject to change, are there any plans to make it more "generics friendly"

I've considered using the event broker to fire events from a generics based class, where the generics type is part of the event name.

My only "solution" so far is to use code to do the registration and subscription of the event, e.g:

IEventCatalogService eventCatalogService = GetService<IEventCatalogService>();
eventCatalogService.Add(new EventTopic("event://My.Application/Document<" + this.TypeName + ">/Opened"));


MethodInfo[] m = typeof(MainForm).GetMethods(BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Static);
IEventCatalogService eventCatalogService = (IEventCatalogService)this.addInContext.GetService(typeof(IEventCatalogService));
BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Static));

The really ugly part is the subscription, where I cannot use the Attribute declared subscription, since it’s hard to make sure that the registration has been done prior to the subscription.