Interface ICommand
Defines the contract for all commands in the CliniCore system Implements Command Pattern for encapsulating requests
public interface ICommand
Properties
CanUndo
Whether this command can be undone
bool CanUndo { get; }
Property Value
CommandId
Unique identifier for this command instance
Guid CommandId { get; }
Property Value
CommandKey
Unique key identifier for this command type (e.g., "login", "createpatient") Used for command registration and invocation.
string CommandKey { get; }
Property Value
CommandName
Name of the command for display/logging purposes
string CommandName { get; }
Property Value
Description
Description of what this command does
string Description { get; }
Property Value
Methods
Execute(CommandParameters, SessionContext?)
Executes the command with the given parameters
CommandResult Execute(CommandParameters parameters, SessionContext? session)
Parameters
parametersCommandParametersThe parameters for the command (will never be null, but may be empty)
sessionSessionContextThe current session context (may be null if not authenticated)
Returns
- CommandResult
Result of the command execution
GetRequiredPermission()
Gets the required permission to execute this command
Permission? GetRequiredPermission()
Returns
- Permission?
The permission required, or null if no specific permission needed
Undo(SessionContext?)
Undoes the command if possible
CommandResult Undo(SessionContext? session)
Parameters
sessionSessionContextThe current session context
Returns
- CommandResult
Result of the undo operation
Validate(CommandParameters, SessionContext?)
Validates that the command can be executed with given parameters
CommandValidationResult Validate(CommandParameters parameters, SessionContext? session)
Parameters
parametersCommandParametersThe parameters for the command (will never be null, but may be empty)
sessionSessionContextThe current session context (may be null if not authenticated)
Returns
- CommandValidationResult
Validation result with any error messages