Class CommandExtensions
- Namespace
- Savvyio.Commands.Messaging
- Assembly
- Savvyio.Commands.Messaging.dll
Extension methods for the ICommand interface.
public static class CommandExtensions
- Inheritance
-
ObjectCommandExtensions
Methods
ToMessage<T>(T, Uri, String, Action<MessageOptions>)
Encloses the specified command
to an instance of Message<T>.
public static IMessage<T> ToMessage<T>(this T command, Uri source, string type, Action<MessageOptions> setup = null)
where T : ICommand
Parameters
command
TThe payload to attach within the message.
source
UriThe context that describes the origin of the message.
type
StringThe type that describes the type of
command
related to the originating occurrence.setup
Action<MessageOptions>The MessageOptions which may be configured.
Returns
- IMessage<T>
An instance of Message<T> constraint to the ICommand interface.
Type Parameters
T
The type of the payload constraint to the ICommand interface.
Exceptions
- System.ArgumentNullException
command
cannot be null - or -source
cannot be null.- ArgumentException
setup
failed to configure an instance of MessageOptions in a valid state.