Table of Contents

Namespace FunctionalDdd

Classes

ActionResultExtensions

Provides extension methods to convert Result types to ASP.NET Core ActionResult responses. These methods bridge Railway Oriented Programming with ASP.NET Core MVC/Web API controllers.

ActionResultExtensionsAsync

Provides asynchronous extension methods to convert Task/ValueTask-wrapped Result types to ASP.NET Core ActionResult responses. These methods enable clean async/await patterns in controllers while maintaining Railway Oriented Programming benefits.

AggregateError

Represents an aggregate of multiple errors that occurred together. Use this when multiple independent errors need to be returned as a single failure result.

Aggregate<TId>

Base class for aggregate roots in Domain-Driven Design. An aggregate is a cluster of domain objects (entities and value objects) that form a consistency boundary. The aggregate root is the only entry point for modifications and ensures all invariants within the boundary are maintained.

BadRequestError

Represents a bad request error indicating the request was malformed or syntactically invalid. Use this for requests that cannot be processed due to syntax errors, missing required data, or malformed content. Maps to HTTP 400 Bad Request.

BindExtensions

Provides extension methods for binding (chaining) operations over Result values.

BindExtensionsAsync

Provides asynchronous extension methods for binding (chaining) operations over Result values.

CombineErrorExtensions

Combine errors into one. If both the errors types are ValidationError, the validation errors will be merged. Otherwise, the errors will be wrapped into an AggregateError.

CombineExtensions

Combines two or more Result<TValue> into one tuple containing all the Results.

CombineExtensionsAsync

Combines two or more Result<TValue> into one tuple containing all the Results.

CommonValueObjectTrace

Provides OpenTelemetry activity tracing for Common Value Objects operations. Enables monitoring and diagnostics of value object creation, validation, and parsing activities.

ConflictError

Represents a conflict error indicating the request conflicts with the current state of the resource. Use this when an operation cannot be completed due to a conflict with existing data or state. Maps to HTTP 409 Conflict.

CvoTracingExtensions

Provides extension methods for configuring OpenTelemetry tracing for Common Value Objects (CVO).

DomainError

Represents a domain or business rule violation. Use this for errors that occur when domain logic or business rules prevent an operation from completing. Maps to HTTP 422 Unprocessable Entity.

EmailAddress

Represents an email address value object with RFC 5322-compliant validation. Ensures that email addresses are syntactically valid and prevents invalid email data in the domain model.

EnsureExtensions

Provides extension methods for ensuring conditions on Result values. If conditions fail, the result is converted to a failure with the specified error.

EnsureExtensionsAsync

Returns a new failure result if the predicate is false. Otherwise returns the starting result.

Entity<TId>

Base class for entities in Domain-Driven Design. An entity is a domain object defined by its identity rather than its attributes. Two entities with different attributes but the same ID are considered equal.

Error

Base class for all error types in the functional DDD library. Errors represent failure states and contain structured information about what went wrong.

FluentValidationResultExtensions

Provides extension methods to integrate FluentValidation with Railway Oriented Programming Result types. Enables seamless conversion of FluentValidation results to Result<T> for functional error handling.

ForbiddenError

Represents a forbidden error when an authenticated user lacks permission to access a resource. Use this when the user is authenticated but does not have the required authorization or role. Maps to HTTP 403 Forbidden.

HttpResponseExtensions

Provides extension methods for handling HTTP response messages with Result and Maybe monads.

HttpResultExtensions

Provides extension methods to convert Result types to ASP.NET Core Minimal API IResult responses. These methods bridge Railway Oriented Programming with ASP.NET Core Minimal APIs.

HttpResultExtensionsAsync

Provides asynchronous extension methods to convert Task/ValueTask-wrapped Result types to ASP.NET Core Minimal API IResult responses. These methods enable clean async patterns in Minimal API endpoints while maintaining Railway Oriented Programming benefits.

MapExtensions

Provides extension methods for mapping (transforming) values inside Result objects.

MapExtensionsAsync

Provides asynchronous extension methods for mapping (transforming) values inside Result objects.

MapOnFailureExtensions

Provides extension methods for transforming errors in failed Results while leaving successful Results unchanged.

MatchErrorExtensions

Pattern matching helpers for discriminating specific error types in Result. Allows matching on specific error types (ValidationError, NotFoundError, etc.) rather than treating all errors the same.

MatchErrorExtensionsAsync

Asynchronous pattern matching helpers for discriminating specific error types in Result.

MatchExtensions

Pattern matching helpers (Match / Switch) for Result.

MatchExtensionsAsync

Asynchronous pattern matching helpers for Result.

Maybe

Contains static methods to create a Maybe<T> object.

MaybeExtensions

Provides extension methods for converting Maybe<T> instances to Result<TValue> objects and for wrapping values in a Result<TValue>.

MaybeExtensionsAsync

Provides asynchronous extension methods for converting Maybe<T> instances to Result<TValue>.

NotFoundError

Represents a "not found" error when a requested resource does not exist. Use this when an entity, record, or resource cannot be located. Maps to HTTP 404 Not Found.

NullableExtensions

Extension methods for converting nullable values to Result types. Provides a convenient way to handle null checking with Railway Oriented Programming.

NullableExtensionsAsync

Asynchronous extension methods for converting nullable values to Result types.

ParallelExtensionsAsync

Execute tasks in parallel and return a Tuple of Result<TValue> tasks.

ParsableJsonConverter<T>

A JSON converter for value objects that implement IParsable<TSelf>. Enables automatic serialization and deserialization of parsable value objects in ASP.NET Core APIs and System.Text.Json scenarios.

PartialObjectResult

Represents an ObjectResult that returns HTTP 206 Partial Content with a Content-Range header. Used to indicate that the response contains a subset of the requested resource.

RailwayTrackAttribute

Indicates which railway track an operation executes on. This metadata can be used by IDE extensions, analyzers, and documentation generators.

RateLimitError

Represents a rate limiting error when too many requests have been made. Use this when a client has exceeded their request quota or rate limit. Maps to HTTP 429 Too Many Requests.

RecoverOnFailureExtensions

Provides extension methods for recovering from failed results by executing fallback operations.

RecoverOnFailureExtensionsAsync

Provides asynchronous extension methods for recovering from failed results.

RequiredGuid

Base class for creating strongly-typed GUID value objects that cannot have the default (empty) GUID value. Provides a foundation for entity identifiers and other domain concepts represented by GUIDs.

RequiredString

Base class for creating strongly-typed string value objects that cannot be null or empty. Provides a foundation for domain primitives like names, descriptions, codes, and other textual concepts.

ResultDebugExtensions

Debug extension methods for inspecting Result values during development. These methods execute only in DEBUG builds and become no-ops in RELEASE builds (with zero overhead).

ResultDebugExtensionsAsync

Debug-only async extension methods for inspecting Result values during development. These methods are only available in DEBUG builds and are automatically excluded from RELEASE builds. Debug information is written to dedicated Activity spans for OpenTelemetry compatibility.

ResultLinqExtensions

Provides LINQ query expression support for Result types, enabling C# query syntax for functional operations.

RopTracerProviderBuilderExtensions

Extension methods for configuring OpenTelemetry tracing for Railway Oriented Programming operations.

ScalarValueObject<T>

Base class for value objects that wrap a single scalar value. Provides a strongly-typed wrapper around primitive types with domain semantics.

ServiceUnavailableError

Represents a temporary service unavailability error. Use this when the service is temporarily unable to handle the request due to maintenance or overload. Maps to HTTP 503 Service Unavailable.

TapExtensions

Provides extension methods for executing side effects on successful Results without changing the Result.

TapExtensionsAsync

Provides asynchronous extension methods for executing side effects on successful Results without changing the Result.

TapOnFailureExtensions

Provides extension methods for executing side effects on failed Results without changing the Result.

TapOnFailureExtensionsAsync

Provides asynchronous extension methods for executing side effects on failed Results without changing the Result.

TraverseExtensions

Transforms a collection of items into a Result containing a collection, short-circuiting on the first failure. Useful for processing collections where each item can fail independently.

UnauthorizedError

Represents an authorization error when authentication is required but not provided. Use this when a user is not authenticated (not logged in) and must authenticate to access the resource. Maps to HTTP 401 Unauthorized.

UnexpectedError

Represents an unexpected system error or exception. Use this for infrastructure failures, unhandled exceptions, or system-level errors. Maps to HTTP 500 Internal Server Error.

ValidationError

Represents validation errors for one or more fields. Used when input data fails business rules or constraints.

ValueObject

Base class for value objects in Domain-Driven Design. A value object represents a descriptive aspect of the domain with no conceptual identity. Value objects are immutable, defined by their attributes, and support structural equality.

WhenExtensions

Conditionally executes an operation based on a predicate, maintaining the railway. Useful for executing operations only when certain conditions are met without breaking the Result chain.

WhenExtensionsAsync

Asynchronous conditional execution operations for Result.

Structs

Maybe<T>

Represents an optional value that may or may not exist. Similar to Nullable<T> but works with both value and reference types. Use this type to make optionality explicit in your domain model and avoid null reference exceptions.

Result

Non-generic Result utility host containing factory and helper methods to construct Result<TValue> instances. NOTE: This struct is not intended to be instantiated; all members are static.

Result<TValue>

Represents either a successful computation (with a value) or a failure (with an Error).

Unit

Represents the absence of a meaningful value, used for operations that have no return value. This is the functional programming equivalent of void, but as a proper type that can be used with generics.

ValidationError.FieldError

Represents an error for a specific field, which may have multiple detail messages.

Interfaces

IAggregate

Defines the contract for an aggregate root in Domain-Driven Design. An aggregate is a cluster of domain objects that can be treated as a single unit for data changes.

IDomainEvent

Represents a domain event - a record of something significant that happened in the business domain. Domain events capture state changes and business occurrences that domain experts care about.

IResult

Non-generic base interface for result types, exposing success/failure state and error information.

IResult<TValue>

Generic interface for result types, providing typed access to the success value.

Enums

TrackBehavior

Defines which railway track an operation runs on in Railway-Oriented Programming.