ARC0002: Missing [Command] attribute on command-like type
Rule
Types that look like commands (properties plus Handle methods) must be marked with [Command] to be recognized as commands.
Severity
Warning
Example
Violation
public class CreateUser
{
public string Name { get; set; }
// ARC0002: Missing [Command] attribute
public void Handle()
{
// Command logic
}
}
Fix
[Command]
public class CreateUser
{
public string Name { get; set; }
public string Email { get; set; }
public void Handle()
{
// Command logic
}
}
[Command]
public class CreateUser
{
public string Name { get; set; }
public UserCreatedResult Handle()
{
return new UserCreatedResult { UserId = Guid.NewGuid() };
}
}
Why This Rule Exists
Commands are identified by the [Command] attribute. Without it:
- Handlers are not discovered by the runtime.
- Validation and metadata generation are incomplete.
- Command routing becomes inconsistent across the system.
Related Rules
- ARC0001: Incorrect query method signature on ReadModel