SenderHelpers.IsSenderValidForMessage Method (IMessageSender, IMessage)
Verifies whether the sender is capable of sending the message based on its SupportedSenderAttribute declaration.
Namespace: Microsoft.ConfigurationManagement.Messaging.Framework
Assembly: Microsoft.ConfigurationManagement.Messaging (in Microsoft.ConfigurationManagement.Messaging.dll)
Syntax
public static bool IsSenderValidForMessage(
IMessageSender sender,
IMessage message
)
public:
static bool IsSenderValidForMessage(
IMessageSender^ sender,
IMessage^ message
)
Public Shared Function IsSenderValidForMessage (
sender As IMessageSender,
message As IMessage
) As Boolean
Parameters
sender
Type: Microsoft.ConfigurationManagement.Messaging.Framework.IMessageSenderSender to validate against the message.
message
Type: Microsoft.ConfigurationManagement.Messaging.Framework.IMessageThe message against which the sender is validated.
Return Value
Type: System.Boolean
True if sender is valid for the message, false if not.
Exceptions
Exception | Condition |
---|---|
ArgumentNullException | You must supply valid sender and message arguments. |
Remarks
If no SupportedSenderAttribute is specified, this method will return true.
Examples
if(false == IsSenderValidForMessage(mySender, myMessage)
{
throw new InvalidOperationException("Cannot use sender " + mySender.GetType() + " with message " + myMessage.GetType());
}
See Also
SenderHelpers Class
Microsoft.ConfigurationManagement.Messaging.Framework Namespace
Return to top