private void DiscoverHubMethods() { var hubType = typeof(THub); foreach (var methodInfo in hubType.GetMethods().Where(IsHubMethod)) { var methodName = methodInfo.Name; if (_methods.ContainsKey(methodName)) { throw new NotSupportedException($"Duplicate definitions of '{methodName}'. Overloading is not supported."); } var executor = ObjectMethodExecutor.Create(methodInfo, hubType.GetTypeInfo()); _methods[methodName] = new HubMethodDescriptor(executor); if (_logger.IsEnabled(LogLevel.Trace)) { _logger.LogTrace("Hub method '{methodName}' is bound", methodName); } } }
public bool TryGetHubMethodDescriptor(string methodName, out HubMethodDescriptor hubMethodDescriptor) { return(_methods.TryGetValue(methodName, out hubMethodDescriptor)); }