/// <summary> /// Builds a dictionary of all possible methods on a given hub. /// Single entry contains a collection of available overloads for a given method name (key). /// This dictionary is being cached afterwards. /// </summary> /// <param name="hub">Hub to build cache for</param> /// <returns>Dictionary of available methods</returns> private static IDictionary <string, IEnumerable <MethodDescriptor> > BuildMethodCacheFor(HubDescriptor hub) { return(ReflectionHelper.GetExportedHubMethods(hub.HubType) .GroupBy(GetMethodName, StringComparer.OrdinalIgnoreCase) .ToDictionary(group => group.Key, group => group.Select(oload => GetMethodDescriptor(group.Key, hub, oload)), StringComparer.OrdinalIgnoreCase)); }
/// <summary> /// Builds a dictionary of all possible methods on a given hub. /// Single entry contains a collection of available overloads for a given method name (key). /// This dictionary is being cached afterwards. /// </summary> /// <param name="hub">Hub to build cache for</param> /// <returns>Dictionary of available methods</returns> private static IDictionary <string, IEnumerable <MethodDescriptor> > BuildMethodCacheFor(HubDescriptor hub) { return(ReflectionHelper.GetExportedHubMethods(hub.HubType) .GroupBy(GetMethodName, StringComparer.OrdinalIgnoreCase) .ToDictionary(group => group.Key, group => group.Select(oload => new MethodDescriptor { ReturnType = oload.ReturnType, Name = group.Key, NameSpecified = (GetMethodAttributeName(oload) != null), Invoker = new HubMethodDispatcher(oload).Execute, Hub = hub, Attributes = oload.GetCustomAttributes(typeof(Attribute), inherit: true).Cast <Attribute>(), Parameters = oload.GetParameters() .Select(p => new ParameterDescriptor { Name = p.Name, ParameterType = p.ParameterType, }) .ToList() }), StringComparer.OrdinalIgnoreCase)); }