public MethodInfo GetMethodInfo(Type handlerType, Type messageHandlerType) { var key = new MessageHandlerInvokerCacheKey(handlerType, messageHandlerType); return(_methodInfoCache.GetOrAdd(key, (cacheKey) => { var methodInfo = handlerType.GetMethod("Handle", new[] { cacheKey.MessageHandlerType }); if (null == methodInfo) { methodInfo = messageHandlerType.GetMethods().Where(method => null != method.GetCustomAttribute <EventSink>()).FirstOrDefault(); } return methodInfo; })); }
public MethodInfo GetMethodInfo(Type handlerType, Type messageHandlerType) { var key = new MessageHandlerInvokerCacheKey(handlerType, messageHandlerType); return(_methodInfoCache.GetOrAdd(key, messageHandlerType.GetMethod("Handle", new[] { handlerType }))); }