Attributes
The full catalog of Elarion attributes — what each one triggers, its parameters, and their defaults.
A lookup-only catalog of every Elarion attribute, grouped by area. Each entry lists the package, what it applies to, a one-line "triggers", and a parameter table (type, default, meaning). For the behavior behind each attribute see the linked capability or concept page.
Parameters are listed as constructor arguments and init properties. Defaults are the literal
defaults baked into the attribute. Enum value tables follow the group they belong to.
Modules & DI
[AppModule]
- Package:
Elarion.Abstractions· Applies to: class - Triggers: groups handlers/services/validators/jobs/consumers under a module boundary and emits the
{ModuleType}ElarionModuleServices.ConfigureDefaultServicessibling plus host bootstrapping; feature modules are gated byModules:{Name}:Enabled.
| Parameter | Type | Default | Meaning |
|---|---|---|---|
name | string (ctor) | required | Unique module name; used for the feature-flag key Modules:{Name}:Enabled and logging. |
Kind | AppModuleKind (init) | Feature | Feature (optional, can be disabled) or Core (always enabled, ignores feature flags). |
DependsOn | string? (init) | null | Comma-separated module names this module depends on; the generator topologically sorts so dependencies initialize first. |
The class may optionally implement convention-based statics: ConfigureServices(IServiceCollection, IConfiguration), MapEndpoints(IEndpointRouteBuilder), GetJsonTypeInfoResolver(), and ConfigureEndpointGroup(IEndpointRouteBuilder).
AppModuleKind: Feature (= 0), Core (= 1).
See Modules.
[Service]
- Package:
Elarion.Abstractions· Applies to: class - Triggers: source-generated DI registration. Without explicit service types, directly implemented interfaces are used as contracts; with none, the implementation type registers as itself. Base-class interfaces are not treated as explicit contracts.
| Parameter | Type | Default | Meaning |
|---|---|---|---|
serviceTypes | params Type[] (ctor) → IReadOnlyList<Type> ServiceTypes | empty | Explicit contract types to register; when empty, contracts are inferred from directly implemented interfaces. |
Scope | ServiceScope (init) | Scoped | DI lifetime. |
ServiceScope: Scoped, Singleton, Transient.
See Services.
[DecoratorList]
- Package:
Elarion.Abstractions(Pipeline) · Applies to: class - Triggers: declares the decorator types for an application-owned pipeline profile attribute so the generator can read the list at compile time. (Pipeline profile attributes themselves, e.g.
DefaultPipelineAttribute, are application-defined, not framework-shipped.)
| Parameter | Type | Default | Meaning |
|---|---|---|---|
decorators | params Type[] (ctor) → Decorators | empty | Ordered decorator types (open generics), applied outermost-first: the first type is the outermost decorator. |
See Decorator pipelines.
Transports
[RpcMethod]
- Package:
Elarion.Abstractions· Applies to: class - Triggers: marks a handler as a dispatcher-based RPC method (the handler must implement
IHandler<TRequest, TResponse>). The method name is declared once and shared by every dispatcher transport;Transportsselects JSON-RPC, MCP, or both. REST is a separate opt-in via[HttpEndpoint].
| Parameter | Type | Default | Meaning |
|---|---|---|---|
methodName | string (ctor) → MethodName | required | The JSON-RPC method name, e.g. "clients.create". |
Transports | RpcTransports (init, [Flags]) | All (JsonRpc | Mcp) | Which dispatcher transports expose the handler. |
RpcTransports: JsonRpc (= 1), Mcp (= 2), All (= JsonRpc \| Mcp).
[McpMethod]
- Package:
Elarion.Abstractions· Applies to: class - Triggers: optional MCP tool-name customization for a handler already on the MCP surface (its
[RpcMethod]TransportsincludesMcp). Purely additive — carries no enable/disable flag. Tool/parameter descriptions come fromSystem.ComponentModel.DescriptionAttribute, not this attribute.
| Parameter | Type | Default | Meaning |
|---|---|---|---|
ToolName | string? (init) | null | Overrides the MCP tool name; when null/empty the name is derived from the RPC method name via the host's transform (e.g. "clients.create" → "clients_create"). |
See MCP.
[HttpEndpoint]
- Package:
Elarion.Abstractions· Applies to: class - Triggers: marks a handler as an HTTP/REST endpoint;
AppModuleDiscoveryGeneratoremits the matching minimal-APIMapGet/MapPost/… registration. The handler must implementIHandler<TRequest, Result<TResponse>>. With no explicit verb the verb is inferred from the request's CQRS marker (ICommand→ POST,IQuery→ GET); a request with neither marker requires an explicit verb (elseELHTTP004). Carries no ASP.NET Core dependency; a handler may carry both this and[RpcMethod].
The attribute has two constructors:
| Constructor | Parameters | Effect |
|---|---|---|
HttpEndpointAttribute(string route) | route (required) | Maps at route, inferring the verb from the request's ICommand/IQuery marker. |
HttpEndpointAttribute(HttpVerb verb, string route) | verb, route (both required) | Maps at route with the explicit verb; sets HasVerb = true. |
Read-only properties:
| Property | Type | Default | Meaning |
|---|---|---|---|
Route | string | required | The route pattern, e.g. "clients/{id}". |
Verb | HttpVerb | default(HttpVerb) = Get | The explicit HTTP method, or the default when HasVerb is false. |
HasVerb | bool | false | Whether Verb was set explicitly; when false the verb is inferred from the CQRS marker. |
HttpVerb: Get, Post, Put, Patch, Delete.
See HTTP endpoints.
[GenerateModuleBootstrapper]
- Package:
Elarion.AspNetCore· Applies to: class - Triggers: marks a partial class to have its module bootstrapper generated by
AppModuleDiscoveryGenerator— the single transport-wiring path; emits per-module and aggregateMap/Addmethods for HTTP, JSON-RPC, and MCP, all module-scoped and feature-flag gated. Marker only — no parameters.
See Hosting.
Scheduling
[ScheduledJob]
- Package:
Elarion.Abstractions· Applies to: method | class - Triggers: marks a method as a compile-time scheduled job or a class as a runtime-schedulable job type. Methods must declare exactly one of
FixedRate,FixedDelay, orCron; runtime-schedulable classes may declare at most one. String values accept${Config:Key}and${Config:Key:-default}placeholders re-resolved per occurrence.
| Parameter | Type | Default | Meaning |
|---|---|---|---|
name | string (ctor) → Name | required | Stable unique job name used in logs, telemetry, and runtime scheduling. |
FixedRate | string? (init) | null | Grid-aligned interval between due times regardless of run duration. Accepts TimeSpan text or suffixes (50ms, 30s, 15m, 6h, 1d). |
FixedDelay | string? (init) | null | Delay between completion of one run and start of the next (polling-loop style). Same duration format; misfire policy does not apply. |
Cron | string? (init) | null | Cron expression with 5 (minute-level) or 6 (second-level) fields, evaluated in TimeZone. "-" disables the schedule. |
TimeZone | string? (init) | null (UTC) | Time-zone id used to evaluate Cron; passed to TimeZoneInfo.FindSystemTimeZoneById after placeholder resolution (prefer IANA ids). |
InitialDelay | string? (init) | null | Optional delay before the first execution (same format as FixedRate). Not valid with Cron. |
RunOnStart | bool (init) | true | Whether interval jobs run once immediately at host start. Not valid with Cron. |
Group | string? (init) | null | Optional key serializing jobs that must not run concurrently; jobs sharing a non-empty group share a serialization gate. |
Overlap | ScheduledJobOverlap (init) | Skip | How occurrences behave when another is already active. |
MisfirePolicy | ScheduledJobMisfirePolicy (init) | FireOnce | How fixed-rate/cron schedules handle missed in-process occurrences. |
MaxConcurrentRuns | int (init) | 0 | Max concurrently executing occurrences when Overlap = AllowConcurrent. 0 means no job-local cap (global scheduler limit still applies); negative is rejected by the generator. |
Enabled | string? (init) | null (always enabled) | "true", "false", or a placeholder, evaluated per occurrence. An unconfigured placeholder without inline default means enabled; an unparseable value means disabled. |
ScheduledJobOverlap: Skip, Queue, AllowConcurrent.
ScheduledJobMisfirePolicy: FireOnce (one overdue, skip intermediate), Skip, CatchUp.
See Scheduling, Schedules, and Overlap and misfire.
Events
[ConsumeEvent]
- Package:
Elarion.Abstractions· Applies to: method | class - Triggers: marks an event consumer, discovered by the event-consumer generator and registered as an
EventSubscriptionDescriptor.- Handler form (preferred): on a class implementing
IHandler<TEvent, Result<T>>(orIHandler<TEvent>sugar) whose request type is the event; runs through the full decorator pipeline. Role inferred from the response type:Result<Unit>= fan-out subscriber,Result<T>withT != Unit= singleRequestAsyncresponder. - Method form: on a method of a
[Service]class (no pipeline); plane taken from the message type marker (IDomainEvent/IIntegrationEvent), role from the return type.
- Handler form (preferred): on a class implementing
| Parameter | Type | Default | Meaning |
|---|---|---|---|
Order | int (init) | 0 | Relative invocation order among fan-out subscribers of the same event, ascending. Equal orders run in a stable generator-determined sequence. |
See Consuming events and Backends.
Caching
[Cacheable]
- Package:
Elarion.Abstractions· Applies to: class - Triggers: marks a handler as cacheable and supplies compile-time metadata to the handler-registration generator. Only successful
Result<T>responses are cached; failed results are returned but not stored.
| Parameter | Type | Default | Meaning |
|---|---|---|---|
tags | params string[] (ctor) → Tags | empty | Logical cache tags for grouping and invalidation. |
DurationSeconds | int (init) | 60 | Entry lifetime in seconds for both distributed and local cache layers. |
Scope | HandlerCacheScope (init) | CurrentUser | Whether generated keys/tags are scoped to the current user or shared globally. |
KeyProperties | string[] (init) | [] | Request property names included in the generated key; when empty, all public request properties are used. Invalid names are reported at build time. |
HandlerCacheScope: CurrentUser (= 0), Global (= 1).
[CacheInvalidate]
- Package:
Elarion.Abstractions· Applies to: class - Triggers: marks a mutating handler as invalidating cached entries for the given tags. Invalidation runs only after the inner handler returns a successful
Result<T>; failed validation or business results do not evict cached reads.
| Parameter | Type | Default | Meaning |
|---|---|---|---|
tags | params string[] (ctor) → Tags | empty | Logical cache tags to invalidate after a successful handler result. |
Scope | HandlerCacheScope (init) | CurrentUser | Whether invalidation applies to the current user's entries or globally shared entries. |
See Caching.
Resilience
[ResiliencePolicy]
- Package:
Elarion.Abstractions· Applies to: class - Triggers: marks a static partial type as a source-generated resilience policy (a named execution behavior applied to handlers and scheduled jobs). Retry options create additional attempts after a handled exception;
Timeoutlimits each individual attempt (not a total deadline across retries).
| Parameter | Type | Default | Meaning |
|---|---|---|---|
name | string (ctor) → Name | required | Stable policy name used by [Resilient] and ScheduledJobOptions.ResiliencePolicy. |
MaxRetryAttempts | int (init) | 3 | Maximum retry attempts after the original attempt (0 = no retries; 3 = up to four total). Supplying this or another retry property enables retry generation. |
Delay | string (init) | "2s" | Base delay before a retry, e.g. 200ms, 2s, 5m, or TimeSpan text. May be changed by Backoff, capped by MaxDelay, randomized by UseJitter. |
Backoff | ResilienceBackoffType (init) | Constant | How retry delays grow between attempts. |
MaxDelay | string? (init) | null | Optional maximum retry delay after applying Backoff; used with linear/exponential backoff to cap waits. |
UseJitter | bool (init) | false | Whether retry delays include jitter so many failures do not retry at the same instant. |
Timeout | string? (init) | null | Optional per-attempt timeout, e.g. 30s or TimeSpan text. Not a total deadline across retries; cancels the attempt token. |
ResilienceBackoffType: Constant, Linear, Exponential.
[Resilient]
- Package:
Elarion.Abstractions· Applies to: class | method - Triggers: applies a named resilience policy to a generated handler or scheduled-job invocation. On handlers and compile-time jobs the policy executes inline around the current invocation; runtime scheduled jobs can alternatively use
ScheduledJobOptionsfor scheduler-deferred retry.
| Parameter | Type | Default | Meaning |
|---|---|---|---|
policyName | string (ctor) → PolicyName | required | Stable policy name registered by a [ResiliencePolicy] type or a manual resilience pipeline registration. |
See Resilience.
EF Core
[DbEntity]
- Package:
Elarion.EntityFrameworkCore· Applies to: class - Triggers: marks an entity class for inclusion in the DbContext; the source generator scans for it to auto-generate
DbSetproperties.
| Parameter | Type | Default | Meaning |
|---|---|---|---|
scopes | params string[] (ctor) → Scopes (IReadOnlyList<string>) | empty | Optional context scopes this entity belongs to. Omit scopes to participate in unscoped/global contexts. |
[GenerateDbSets]
- Package:
Elarion.EntityFrameworkCore· Applies to: interface - Triggers: applied to a partial DbContext interface; generates
DbSet<T>properties for each[DbEntity]class,DbSet<T>properties on implementing DbContext classes, andConfigureEntities(ModelBuilder)on implementing DbContext classes.
| Parameter | Type | Default | Meaning |
|---|---|---|---|
scopes | params string[] (ctor) → Scopes (IReadOnlyList<string>) | empty | Optional context scopes generated for this interface. Omit scopes to include every [DbEntity]. |
[Keyset<TEntity>]
- Package:
Elarion.Paging· Applies to: class (generic attribute,where TEntity : class) - Triggers: declares an ordered keyset (seek) definition for
TEntityon the annotated partial class. The EF Core generator fills the class with a reflection-freeIKeysetDefinition<TEntity>implementation (ordering, seek predicate, opaque cursor codec) plus a staticDefinitionsingleton, so handlers page viasource.ToKeysetPageAsync(request, MyKeyset.Definition, selector). Declared on a dedicated partial class (not the entity), so an entity may have any number of orderings. Non-partial or nested keyset classes are reported (ELKEY005).
| Parameter | Type | Default | Meaning |
|---|---|---|---|
TEntity | type parameter (where TEntity : class) | required | The entity type being paginated. |
columns | params string[] (ctor) → Columns (IReadOnlyList<string>) | empty | Ordered keyset column names in precedence order; each names a property on TEntity. Ascending by default; a leading - marks the column descending (e.g. "-CreatedAt"). The final column should be unique (typically the primary key) for determinism. |
See Entity Framework and Pagination.
Cross-module communication
[ModuleContract]
- Package:
Elarion.Abstractions(Modules) · Applies to: interface | class - Triggers: marks a module's published cross-module surface — the stable type other modules may depend on. The owning module keeps the implementation
internal; other modules inject the contract.ModuleBoundaryAnalyzer(ELMOD002) reports cross-module references to internal[Service]/handler/entity types but allows references to a[ModuleContract]type. Marker only — no parameters.
[ModuleApi]
- Package:
Elarion.Abstractions(Modules) · Applies to: class - Triggers: configures how a handler participates in its module's generated typed in-process API (see
[GenerateModuleApi]). A configurator, never a gate: every handler is in the default facade automatically (opt-out). Apply only to exclude a handler or to tag it into named scopes (additive). Scope vocabulary mirrors[DbEntity]/[GenerateDbSets].
| Parameter | Type | Default | Meaning |
|---|---|---|---|
scopes | params string[] (ctor) → Scopes (IReadOnlyList<string>) | empty | Named scopes this handler is tagged into so it also appears on matching scoped facades. Empty means the handler participates only in the module's default (unscoped) facade. |
Exclude | bool (init) | false | When true, the handler is excluded from every generated facade, scoped or default. |
[GenerateModuleApi]
- Package:
Elarion.Abstractions(Modules) · Applies to: interface - Triggers: marks a partial interface to be filled with a typed in-process API over the owning module's handlers — one method per handler, dispatched typed-direct to
IHandler<TRequest, TResponse>(full decorator pipeline, no serialization). Not a transport and absent from the JSON-RPC/MCP schema; module-internal (must not cross boundaries). The interface must be partial and at namespace scope. DiagnosticsELAPI001–ELAPI004.
| Parameter | Type | Default | Meaning |
|---|---|---|---|
scopes | params string[] (ctor) → Scopes (IReadOnlyList<string>) | empty | The scopes this facade selects. Empty = default facade (every non-excluded handler in the owning module by longest-prefix namespace match); one or more = only handlers tagged with an intersecting scope via [ModuleApi]. |
See Cross-module communication.
Assembly opt-ins
[UseElarion]
- Package:
Elarion.Abstractions· Applies to: assembly - Triggers: enables all Elarion source-generation features at once — equivalent to applying
[GenerateModuleHandlers],[GenerateModuleServices],[GenerateModuleValidators],[GenerateScheduledJobs],[GenerateEventConsumers], and[GenerateResiliencePolicies]. Application-owned attributes such as pipeline defaults remain explicit. Marker only — no parameters.
Individual generation triggers
All are Elarion.Abstractions, applied to the assembly, marker-only (no parameters), and subsumed by [UseElarion].
| Attribute | Triggers |
|---|---|
[GenerateModuleHandlers] | Per-module handler registration methods. |
[GenerateModuleServices] | Per-module service registration methods. |
[GenerateModuleValidators] | Per-module validator registration methods. |
[GenerateScheduledJobs] | Source-generated scheduler descriptor registration. |
[GenerateEventConsumers] | Source-generated event-consumer descriptor registration. |
[GenerateResiliencePolicies] | Source-generated resilience-policy registration. |
[UseElarionEntityFrameworkCore]
- Package:
Elarion.EntityFrameworkCore· Applies to: assembly - Triggers: declares the target database provider so EF Core generators can emit provider-optimized variants (the EF Core analogue of
[assembly: UseElarion]). When omitted, generators behave asPortableand emit provider-neutral code.
| Parameter | Type | Default | Meaning |
|---|---|---|---|
Provider | EfCoreProvider (init) | Portable (= 0) | Target database provider. |
EfCoreProvider: Portable (= 0, provider-neutral code), Npgsql (= 1, opts generated keyset seek predicates into PostgreSQL row-value comparisons; requires the Npgsql EF Core provider be referenced).
See Entity Framework.