Skip to content

Command Model

Iuga Alexandru edited this page May 16, 2023 · 2 revisions

A Command class is the equivalent of:

  • a Page class from ASP.NET Razor Pages;
  • a View Model class from the MVVM pattern used in WPF.

The Command

Here it is an example of a Command:

[Command("dummy", ShortDescription = "A dummy command that shows how to use Commando.")]
public class DummyCommand : ICommand
{
    [CommandParameter(Name = "text", ShortName = 't', IsOptional = true)]
    public string DummyText { get; set; }

    public Task Execute()
    {
        DummyText += " - additional text";

        return Task.CompletedTask;
    }
}

For more details about the command: