IsCommandType() public method

Returns true if the given type is a command type.
public IsCommandType ( Type t ) : bool
t System.Type
return bool
Ejemplo n.º 1
0
 public IEnumerable <PublisherTableEntry> GenerateWithoutBestPracticeEnforcement(Conventions conventions)
 {
     if (!conventions.IsMessageType(messageType))
     {
         throw new Exception($"Cannot configure publisher for type '{messageType.FullName}' because it is not considered a message. Message types have to either implement NServiceBus.IMessage interface or match a defined message convention.");
     }
     if (conventions.IsCommandType(messageType))
     {
         throw new Exception($"Cannot configure publisher for type '{messageType.FullName}' because it is a command.");
     }
     yield return(new PublisherTableEntry(messageType, address));
 }
Ejemplo n.º 2
0
 public IEnumerable<PublisherTableEntry> GenerateWithoutBestPracticeEnforcement(Conventions conventions)
 {
     if (!conventions.IsMessageType(messageType))
     {
         throw new Exception($"Cannot configure publisher for type '{messageType.FullName}' because it is not considered a message. Message types have to either implement NServiceBus.IMessage interface or match a defined message convention.");
     }
     if (conventions.IsCommandType(messageType))
     {
         throw new Exception($"Cannot configure publisher for type '{messageType.FullName}' because it is a command.");
     }
     yield return new PublisherTableEntry(messageType, address);
 }
        public IEnumerable<PublisherTableEntry> GenerateWithoutBestPracticeEnforcement(Conventions conventions)
        {
            var entries = messageAssembly.GetTypes()
                .Where(type => conventions.IsMessageType(type) && !conventions.IsCommandType(type))
                .Select(t => new PublisherTableEntry(t, address))
                .ToArray();

            if (!entries.Any())
            {
                throw new Exception($"Cannot configure publisher for assembly {messageAssembly.GetName().Name} because it contains no types considered as messages. Message types have to either implement NServiceBus.IMessage interface or match a defined convention.");
            }

            return entries;
        }
        public IEnumerable <PublisherTableEntry> GenerateWithoutBestPracticeEnforcement(Conventions conventions)
        {
            var entries = messageAssembly.GetTypes()
                          .Where(type => conventions.IsMessageType(type) && !conventions.IsCommandType(type))
                          .Select(t => new PublisherTableEntry(t, address))
                          .ToArray();

            if (!entries.Any())
            {
                throw new Exception($"Cannot configure publisher for assembly {messageAssembly.GetName().Name} because it contains no types considered as messages. Message types have to either implement NServiceBus.IMessage interface or match a defined convention.");
            }

            return(entries);
        }