Skip to content

Attribute reference

Arc discovers what your application exposes from attributes on your own types. This is the whole set you write, grouped by what it concerns. Attributes that come from Chronicle or Fundamentals rather than Arc are marked as such, because they arrive with a different package.

For the Kotlin and Java equivalents, see its annotation reference — the concepts match, the spellings do not.

AttributeValid onEffect
[Command]classMarks a record or class as a command. Arc exposes it, validates and authorizes it, and calls its Handle() method.
[ReadModel]classMarks a type as a read model. Its static methods become queries.
[Command]
public record RegisterAuthor(AuthorId Id, AuthorName Name)
{
public Task Handle(IMongoCollection<Author> authors) =>
authors.InsertOneAsync(new Author(Id, Name));
}
AttributeValid onEffect
[Path]class, methodOverrides the route Arc would otherwise derive from the type or method name.
[QueryHttpMethod]class, methodChooses the HTTP method a query is exposed with, where more than one is supported.
[FromRequest]parameter, propertyBinds a value from several request sources rather than the default one.

A route you do not override is derived, so [Path] is for the cases where the derived route is wrong for you — not something to apply everywhere.

AttributeValid onEffect
[Authorize]class, methodRequires an authenticated caller, optionally satisfying a policy.
[Roles]class, methodRequires at least one of the listed roles.
[AllowAnonymous]class, methodOpens a specific artifact or operation back up.

Apply them at class level to cover everything and override per method for the exceptions — secure by default, opened where you mean it. A failure surfaces as isAuthorized: false in the result rather than as an exception, so the frontend can react to it.

AttributeValid onEffect
[IgnoreValidation]class, methodExcludes an artifact from validation that would otherwise apply.

Most validation is declared in a CommandValidator<T> or ConceptValidator<T> rather than with an attribute. See validation.

AttributeValid onEffect
[IgnoreAutoRegistration]classKeeps a type out of Arc’s conventional discovery.
[AspNetResult]class, methodReturns the ASP.NET Core result directly instead of Arc’s result envelope.

[AspNetResult] opts out of the envelope the generated client expects, so a proxy will not consume that endpoint in the usual way. Reach for it when an endpoint exists for something other than your own frontend.

These arrive with Chronicle rather than Arc itself, and only apply when the Chronicle integration is in use.

AttributeValid onEffect
[EventType]classMarks a record as an event. Takes no arguments for a new event.
[Key]propertyIdentifies the event source a command acts on.
[NotAudited]class, struct, property, parameterKeeps a secret out of the causation chain written with every event.
[ExecuteCommandsAsSystem]classRuns a reactor’s returned commands without a user principal.

[NotAudited] is the one worth knowing before you need it: a command’s property values are recorded in the causation chain of every event it appends, so an unmarked token or password reaches the event log in clear text and stays there. It is not interchangeable with Chronicle’s [PII], which encrypts and enrolls a value in erasure — that is the right marking for personal data and the wrong one for a secret.

  • Code analysis — the analyzers that check these are used correctly.
  • Commands and Queries — what the artifact attributes actually enable.