private MethodInfo registerLocallyForEvent(EventInfo eventInfo, object target)
{
EventHandlerFactory factory = new EventHandlerFactory("testing");
object handler = factory.GetEventHandler(eventInfo);
// Create a delegate, which points to the custom event handler
Delegate customEventDelegate = Delegate.CreateDelegate(eventInfo.EventHandlerType, handler, "CustomEventHandler");
// Link event handler to event
eventInfo.AddEventHandler(target, customEventDelegate);
// Map our own event handler to the common event
EventInfo commonEventInfo = handler.GetType().GetEvent("CommonEvent");
Delegate commonDelegate = Delegate.CreateDelegate(commonEventInfo.EventHandlerType, this, "MyEventCallback");
commonEventInfo.AddEventHandler(handler, commonDelegate);
return null;
}