示例#1
0
        /// <summary>
        /// Returns true if the given type is a event type.
        /// </summary>
        public bool IsEventType(Type t)
        {
            Guard.AgainstNull(nameof(t), t);
            try
            {
                return(EventsConventionCache.ApplyConvention(t, typeHandle =>
                {
                    var type = Type.GetTypeFromHandle(typeHandle);
                    if (type.IsFromParticularAssembly())
                    {
                        return false;
                    }

                    foreach (var convention in conventions)
                    {
                        if (convention.IsEventType(type))
                        {
                            if (logger.IsDebugEnabled)
                            {
                                logger.Debug($"{type.FullName} identified as event type by {convention.Name} convention.");
                            }
                            return true;
                        }
                    }

                    return false;
                }));
            }
            catch (Exception ex)
            {
                throw new Exception("Failed to evaluate Event convention. See inner exception for details.", ex);
            }
        }
示例#2
0
 /// <summary>
 /// Returns true if the given type is a event type.
 /// </summary>
 /// <param name="t"></param>
 /// <returns></returns>
 public static bool IsEventType(Type t)
 {
     try
     {
         return(EventsConventionCache.ApplyConvention(t, type => IsEventTypeAction(type)));
     }
     catch (Exception ex)
     {
         throw new MessageConventionException("Failed to evaluate Event convention. See inner exception for details.", ex);
     }
 }
 /// <summary>
 /// Returns true if the given type is a event type.
 /// </summary>
 /// <param name="t"></param>
 /// <returns></returns>
 public static bool IsEventType(this Type t)
 {
     try
     {
         return(EventsConventionCache.ApplyConvention(t, type => IsEventTypeAction(type)));
     }
     catch (Exception ex)
     {
         Logger.Error("Failed to evaluate Event convention: " + ex);
         throw;
     }
 }
示例#4
0
 /// <summary>
 ///     Returns true if the given type is a event type.
 /// </summary>
 public bool IsEventType(Type t)
 {
     try
     {
         return(EventsConventionCache.ApplyConvention(t, type =>
         {
             if (type.IsFromParticularAssembly())
             {
                 return false;
             }
             return IsEventTypeAction(type);
         }));
     }
     catch (Exception ex)
     {
         throw new Exception("Failed to evaluate Event convention. See inner exception for details.", ex);
     }
 }
示例#5
0
 /// <summary>
 /// Returns true if the given type is a event type.
 /// </summary>
 public bool IsEventType(Type t)
 {
     Guard.AgainstNull(nameof(t), t);
     try
     {
         return(EventsConventionCache.ApplyConvention(t, typeHandle =>
         {
             var type = Type.GetTypeFromHandle(typeHandle);
             if (type.IsFromParticularAssembly())
             {
                 return false;
             }
             return IsEventTypeAction(type);
         }));
     }
     catch (Exception ex)
     {
         throw new Exception("Failed to evaluate Event convention. See inner exception for details.", ex);
     }
 }
示例#6
0
 /// <summary>
 /// Returns true if the given type is a event type.
 /// </summary>
 /// <param name="t"></param>
 /// <returns></returns>
 public static bool IsEventType(this Type t)
 {
     return(EventsConventionCache.ApplyConvention(t, type => IsEventTypeAction(type)));
 }