Table of Contents

Interface ICommand

Namespace
Core.CliniCore.Commands
Assembly
Core.CliniCore.dll

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

bool

CommandId

Unique identifier for this command instance

Guid CommandId { get; }

Property Value

Guid

CommandKey

Unique key identifier for this command type (e.g., "login", "createpatient") Used for command registration and invocation.

string CommandKey { get; }

Property Value

string

CommandName

Name of the command for display/logging purposes

string CommandName { get; }

Property Value

string

Description

Description of what this command does

string Description { get; }

Property Value

string

Methods

Execute(CommandParameters, SessionContext?)

Executes the command with the given parameters

CommandResult Execute(CommandParameters parameters, SessionContext? session)

Parameters

parameters CommandParameters

The parameters for the command (will never be null, but may be empty)

session SessionContext

The 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

session SessionContext

The 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

parameters CommandParameters

The parameters for the command (will never be null, but may be empty)

session SessionContext

The current session context (may be null if not authenticated)

Returns

CommandValidationResult

Validation result with any error messages