/// <inheritdoc /> public void Handle(IMessageContext messageContext) { // Find handler methods. var eventtype = messageContext.Content.GetType(); if (InternalLogger.IsDebugEnabled) { InternalLogger.Debug(string.Format(Properties.Strings.SearchEventHandler, eventtype.Name), nameof(EventHandlerLocatorMiddleware)); } var methods = cache.GetOrAdd(eventtype, FindOrCreateMethodHandlers); if (InternalLogger.IsDebugEnabled) { DumpFoundMethods(methods, eventtype); } messageContext.Items.TryGetValue(HandlerMethodsKey, out object handlersObj); var methodsWrap = methods.Select(m => new EventHandlerMethodWithObject(m)).ToArray(); var handlers = handlersObj as EventHandlerMethodWithObject[]; messageContext.Items[HandlerMethodsKey] = ArrayHelpers.AddItems(handlers, methodsWrap); }