protected DashboardHub(IHubUserConnectionTrackingStrategy connectionTrackingStrategy) { _connectionTrackingStrategy = connectionTrackingStrategy; HubNameAttribute hubAttribute = (HubNameAttribute)Attribute.GetCustomAttribute(GetType(), typeof(HubNameAttribute)); _hubName = hubAttribute.HubName; }
private string GetHubName(Type type) { HubNameAttribute attribute = type.GetCustomAttributes(typeof(HubNameAttribute), false).Cast <HubNameAttribute>().SingleOrDefault(); return(attribute != null ? attribute.HubName : type.Name); }
public static string GetHubName(this Type hubType) { string result = string.Empty; List <HubNameAttribute> attributes = hubType.GetCustomAttributes(typeof(HubNameAttribute), true).Cast <HubNameAttribute>().ToList(); if (attributes.Count > 0) { HubNameAttribute hubNameAttribute = attributes.FirstOrDefault(); if (hubNameAttribute != null && !string.IsNullOrWhiteSpace(hubNameAttribute.HubName)) { result = hubNameAttribute.HubName; } } else { result = hubType.Name; } return(result); }