Pip-Services-Commons-Dotnet
|
Contains a set of commands and events supported by a ICommandable object. The CommandSet supports command interceptors to extend and the command call chain. CommandSets can be used as alternative commandable interface to a business object. It can be used to auto generate multiple external services for the business object without writing much code. More...
Public Member Functions | |
CommandSet () | |
Creates an empty CommandSet object. More... | |
ICommand | FindCommand (string command) |
Searches for a command by its name. More... | |
IEvent | FindEvent (string ev) |
Searches for an event by its name in this command set. More... | |
void | AddCommand (ICommand command) |
Adds a ICommand command to this command set. More... | |
void | AddCommands (IEnumerable< ICommand > commands) |
Adds multiple ICommand commands to this command set. More... | |
void | AddEvent (IEvent ev) |
Adds an IEvent event to this command set. More... | |
void | AddEvents (IEnumerable< IEvent > events) |
Adds multiple IEvent events to this command set. More... | |
void | AddCommandSet (CommandSet commandSet) |
Adds all of the commands and events from specified CommandSet command set into this one. More... | |
void | AddInterceptor (ICommandInterceptor intercepter) |
Adds a ICommandInterceptor command interceptor to this command set. More... | |
Task< object > | ExecuteAsync (string correlationId, string command, Parameters args) |
Executes a ICommand command specificed by its name. More... | |
IList< ValidationResult > | Validate (string command, Parameters args) |
Validates Parameters args for command specified by its name using defined schema.If validation schema is not defined than the methods returns no errors.It returns validation error if the command is not found. More... | |
void | AddListener (IEventListener listener) |
Adds a IEventListener listener to receive notifications on fired events. More... | |
void | RemoveListener (IEventListener listener) |
Removes previosly added IEventListener listener. More... | |
async Task | NotifyAsync (string correlationId, string ev, Parameters value) |
Fires event specified by its name and notifies all registered IEventListener listeners More... | |
Properties | |
List< ICommand > | Commands [get] |
Gets all commands registered in this command set. More... | |
List< IEvent > | Events [get] |
Gets all events registred in this command set. More... | |
Private Member Functions | |
void | BuildCommandChain (ICommand command) |
void | RebuildAllCommandChains () |
Private Attributes | |
List< ICommand > | _commands = new List<ICommand>() |
List< IEvent > | _events = new List<IEvent>() |
readonly Dictionary< string, ICommand > | _commandsByName = new Dictionary<string, ICommand>() |
readonly Dictionary< string, IEvent > | _eventsByName = new Dictionary<string, IEvent>() |
readonly List< ICommandInterceptor > | _intercepters = new List<ICommandInterceptor>() |
Contains a set of commands and events supported by a ICommandable object. The CommandSet supports command interceptors to extend and the command call chain. CommandSets can be used as alternative commandable interface to a business object. It can be used to auto generate multiple external services for the business object without writing much code.
See ICommandable, Command, Event
PipServices3.Commons.Commands.CommandSet.CommandSet | ( | ) |
Creates an empty CommandSet object.
void PipServices3.Commons.Commands.CommandSet.AddCommand | ( | ICommand | command | ) |
void PipServices3.Commons.Commands.CommandSet.AddCommands | ( | IEnumerable< ICommand > | commands | ) |
void PipServices3.Commons.Commands.CommandSet.AddCommandSet | ( | CommandSet | commandSet | ) |
Adds all of the commands and events from specified CommandSet command set into this one.
commandSet | The commands set to add. |
void PipServices3.Commons.Commands.CommandSet.AddEvent | ( | IEvent | ev | ) |
void PipServices3.Commons.Commands.CommandSet.AddEvents | ( | IEnumerable< IEvent > | events | ) |
void PipServices3.Commons.Commands.CommandSet.AddInterceptor | ( | ICommandInterceptor | intercepter | ) |
Adds a ICommandInterceptor command interceptor to this command set.
intercepter | The intercepter to add. |
void PipServices3.Commons.Commands.CommandSet.AddListener | ( | IEventListener | listener | ) |
Adds a IEventListener listener to receive notifications on fired events.
listener | The listener to add. |
Task<object> PipServices3.Commons.Commands.CommandSet.ExecuteAsync | ( | string | correlationId, |
string | command, | ||
Parameters | args | ||
) |
Executes a ICommand command specificed by its name.
correlationId | Unique correlation/transaction id. |
command | Command name. |
args | Command arguments. |
ValidationException | when execution fails for validation reason. |
See ICommand, Parameters
ICommand PipServices3.Commons.Commands.CommandSet.FindCommand | ( | string | command | ) |
Searches for a command by its name.
command | The command name. |
See ICommand
IEvent PipServices3.Commons.Commands.CommandSet.FindEvent | ( | string | ev | ) |
Searches for an event by its name in this command set.
ev | the name of the event to search for. |
See IEvent
async Task PipServices3.Commons.Commands.CommandSet.NotifyAsync | ( | string | correlationId, |
string | ev, | ||
Parameters | value | ||
) |
Fires event specified by its name and notifies all registered IEventListener listeners
correlationId | optional transaction id to trace calls across components. |
ev | the name of the event that is to be fired. |
value | the event arguments (parameters). |
void PipServices3.Commons.Commands.CommandSet.RemoveListener | ( | IEventListener | listener | ) |
Removes previosly added IEventListener listener.
listener | The listener to remove. |
IList<ValidationResult> PipServices3.Commons.Commands.CommandSet.Validate | ( | string | command, |
Parameters | args | ||
) |
Validates Parameters args for command specified by its name using defined schema.If validation schema is not defined than the methods returns no errors.It returns validation error if the command is not found.
command | the name of the command for which the 'args' must be validated. |
args | the parameters (arguments) to validate. |
|
get |
|
getprivate |