Namespace REslava.Result

Classes

AsyncPredicateValidatorRule<T, TProperty>

A validation rule that uses an async predicate function to validate a property of an entity. Supports async lambda expressions for asynchronous validation scenarios.

ConflictError

Represents a conflict error (HTTP 409 equivalent). Use when an operation conflicts with existing state (duplicates, version conflicts).

ConversionError

Represents an error that occurred during implicit type conversion. This error is used when implicit operators receive invalid input (null, empty collections, etc.) instead of throwing exceptions, keeping the API consistent with the Result pattern philosophy.

DomainBoundaryAttribute

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.

DomainTags

Predefined TagKey<T> constants for domain error context. Used by built-in error factories and available for custom errors and queries.

Error
ExceptionError

Wraps a .NET Exception as a typed error reason. Automatically captures the exception type, stack trace, and inner exception message as tags. Produced automatically by Try(Action, Func<Exception, IError>?) and TryAsync(Func<Task>, Func<Exception, IError>?, CancellationToken).

ForbiddenError

Represents an authorization error (HTTP 403 equivalent). Use when the caller is authenticated but lacks permission.

NotFoundError

Represents a "not found" error (HTTP 404 equivalent). Use when a requested resource does not exist.

PipelineObserver

Registers a ResultFlowObserver to receive pipeline execution events from Bind, Map, Ensure, Tap, and Match calls.

PipelineScope

Represents an active pipeline execution scope. Call End(bool, string?, string?) with the final result before the scope is disposed, then dispose in a finally block.

PredicateValidatorRule<T, TProperty>

A validation rule that uses a predicate function to validate a property of an entity. Supports lambda expressions for concise rule definitions.

Reason

Abstract base class for all result reasons (errors and successes). Provides immutable Message and Tags storage with a consistent ToString() representation.

ReasonMetadata

System/diagnostic metadata captured automatically when an error or success is created. Separate from Tags, which holds user/business metadata.

ReasonMetadataExtensions

Extension methods for ergonomic access to IReasonMetadata from IReason references.

ReasonTagExtensions

Extension methods for typed tag access on IReason using TagKey<T>.

Reason<TReason>
Result

Factory methods for non-generic Result.

ResultContext

Carries ambient context through a Result pipeline — entity type, runtime identity, correlation, operation name, and tenant. Seeded automatically by Ok/Fail factories and propagated by all pipeline operators (parent-wins).

ResultMapErrorExtensions

Extension methods for transforming errors in the failure path of Result types.

ResultMatchExtensions

Extension methods for match operations on Result types.

ResultOrExtensions

Extension methods for providing fallback results on failure.

ResultSwitchExtensions

Extension methods for void side-effect dispatch on Result types.

Result<TValue>

Represents the result of an operation with a value of type TValue. Immutable by design - all operations return new instances.

Result<TValue, TError>

Represents the result of an operation with a typed value and a strongly-typed error. The error type is constrained to IError, enabling exhaustive error matching when combined with ErrorsOf<T1, T2> error unions.

Success
SystemTags

Predefined TagKey<T> constants for integration and infrastructure context. Used by REslava.Result.Http and REslava.Result.AspNetCore packages.

TagAccessExtensions

Extension methods for safe tag access on Reason and Error types.

TagKey

Base type for typed tag keys that provide type-safe access to Tags.

TagKey<T>

A typed key for accessing a tag value of type T from Tags.

UnauthorizedError

Represents an authentication error (HTTP 401 equivalent). Use when the caller is not authenticated or credentials are invalid.

ValidationError

Represents a validation error (HTTP 400/422 equivalent). Use when input data fails validation rules.

ValidationExtensions

Provides consistent validation extension methods with standardized error messages. All methods throw ArgumentException (or ArgumentNullException) with consistent formatting. Use these to validate inputs and maintain consistent error messages across the library.

ValidationResult<T>

Represents the result of a validation operation with a value of type T. Inherits from Result<T> and provides validation-specific convenience methods.

ValidatorRuleBuilderExtensions

Extension methods on ValidatorRuleBuilder<T> providing a native DSL for common validation rules (string, numeric, collection, null checks).

ValidatorRuleBuilder<T>

Fluent builder for creating validation rule sets for a specific entity type. Provides a fluent API for defining validation rules with method chaining.

ValidatorRuleSet<T>

Immutable collection of validation rules for a specific entity type. Provides methods to validate entities against all rules in the set.

Interfaces

IError

Marker interface for error reasons. Implement or extend to create custom error types that integrate with Result<TValue> failure semantics and HTTP status mapping.

IErrorFactory<TSelf>

Opt-in interface that enables generic error construction via a static factory method. Implement on custom error types to participate in Result.Fail<TError>(string).

IReason

Base contract for all result reasons — errors, successes, and custom outcomes. All reasons carry a human-readable message and an optional metadata dictionary.

IReasonMetadata

Secondary capability interface for reasons that expose system/diagnostic metadata. Implement alongside IReason to opt-in to metadata support.

IResultBase

Non-generic contract for a result — exposes status flags and reason lists without requiring knowledge of the success value type. Useful for middleware, logging pipelines, and generic result-handling utilities.

IResultBase<TValue>

Generic contract for a typed result — extends IResultBase with access to the successful value.

ISuccess

Marker interface for success reasons. Implement to attach structured metadata to a successful result without changing its value.

IValidatorRuleAsync<T>
IValidatorRuleCombined<T>
IValidatorRuleSync<T>
IValidatorRule<T>