コード例 #1
0
ファイル: ClientMessage.cs プロジェクト: joemcbride/fubumvc
        public static string GetMessageName(this Type type)
        {
            string messageName = null;

            if (type.HasAttribute<ClientMessageAttribute>())
            {
                messageName = type.GetAttribute<ClientMessageAttribute>().MessageName;
            }

            if (type.CanBeCastTo<ClientMessage>())
            {
                messageName = Activator.CreateInstance(type).As<ClientMessage>().MessageName();
            }

            return messageName.IsEmpty()
                ? type.GetDefaultMessageName()
                : messageName;
        }
コード例 #2
0
 public static bool IsAuthenticatedAPIRequest(this Type type)
 {
     return type.CanBeCastTo<IApi>();
 }
コード例 #3
0
ファイル: ClientMessage.cs プロジェクト: joemcbride/fubumvc
 public static bool IsClientMessage(this Type type)
 {
     if (type == null) return false;
     return type.HasAttribute<ClientMessageAttribute>() || type.CanBeCastTo<ClientMessage>();
 }