protected DashboardHub(IHubUserConnectionTrackingStrategy connectionTrackingStrategy)
        {
            _connectionTrackingStrategy = connectionTrackingStrategy;
            HubNameAttribute hubAttribute = (HubNameAttribute)Attribute.GetCustomAttribute(GetType(), typeof(HubNameAttribute));

            _hubName = hubAttribute.HubName;
        }
Exemple #2
0
        private string GetHubName(Type type)
        {
            HubNameAttribute attribute =
                type.GetCustomAttributes(typeof(HubNameAttribute), false).Cast <HubNameAttribute>().SingleOrDefault();

            return(attribute != null ? attribute.HubName : type.Name);
        }
Exemple #3
0
        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);
        }