Class DomainBoundaryAttribute

Namespace
REslava.Result
Assembly
REslava.Result.dll

Marks a method or class as a domain boundary crossing point. When applied to a class, all methods in the class inherit the layer annotation.

[AttributeUsage(AttributeTargets.Class|AttributeTargets.Constructor|AttributeTargets.Method, Inherited = false)]
public sealed class DomainBoundaryAttribute : Attribute
Inheritance
DomainBoundaryAttribute
Inherited Members
Extension Methods

Examples

// Class-level annotation — all methods in UserService are tagged as "Domain"
[DomainBoundary("Domain")]
static class UserService { ... }

// Method-level annotation — takes precedence over class annotation
[DomainBoundary("Application")]
public void ProcessOrder(Result<Order, ErrorsOf<DomainError>> result) { ... }

// Caller must map first:
ProcessOrder(domainResult.MapError(e => new AppError(e.Message)));

Remarks

When a Result<T, TError> with a typed error union is passed to a [DomainBoundary]-marked method without calling .MapError() first, the RESL1030 analyzer reports a warning. This enforces that domain-specific typed error surfaces are translated before crossing architectural layers.

The optional layer parameter is also used by REslava.Result.Flow source generator to annotate diagram nodes with their architectural layer (_LayerView, _Stats, _ErrorSurface, _ErrorPropagation). Priority order: method annotation → class annotation → namespace heuristics.

Constructors

DomainBoundaryAttribute()

Marks this method as a domain boundary.

public DomainBoundaryAttribute()

DomainBoundaryAttribute(string)

Marks this method as a domain boundary with a named layer label.

public DomainBoundaryAttribute(string layer)

Parameters

layer string

The architectural layer this method belongs to (e.g. "Application").

Properties

Layer

Optional layer label for diagram annotation (e.g. "Application", "Infrastructure").

public string? Layer { get; }

Property Value

string