Lyo.Result 1.0.2

dotnet add package Lyo.Result --version 1.0.2
                    
NuGet\Install-Package Lyo.Result -Version 1.0.2
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="Lyo.Result" Version="1.0.2" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Lyo.Result" Version="1.0.2" />
                    
Directory.Packages.props
<PackageReference Include="Lyo.Result" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add Lyo.Result --version 1.0.2
                    
#r "nuget: Lyo.Result, 1.0.2"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package Lyo.Result@1.0.2
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=Lyo.Result&version=1.0.2
                    
Install as a Cake Addin
#tool nuget:?package=Lyo.Result&version=1.0.2
                    
Install as a Cake Tool

Lyo.Result

Railway-oriented Result / Result<T> and related types. This package is orthogonal to Lyo.Common Result (different namespace and design); many feature libraries pick Lyo.Result when they want rich Error graphs, builders, bulk/paged envelopes, and Task composition without pulling the whole API layer.

Concepts — Result<T> and IResult<T>

  • IsSuccess, Data, Errors, Timestamp, Metadata (optional key/value bag on ResultBase).
  • Factory methods: Result<T>.Success(...), Failure(IReadOnlyList<Error>), Failure(Error), Failure(message, code, …), Failure(Exception, …).
  • Unwrap / extract: TryGetValue, ValueOrThrow, ValueOrDefault, Match, Map / MapAsync, Tap side effects, boolean operators where defined on the record.

Concepts — Error

Error is an immutable record with: - Message, Code, Severity, Type (ErrorType: Generic, Validation, NotFound, Conflict, Unauthorized, …). - StackTrace, Exception, InnerError (chained errors mimic exception chains). - Metadata, Timestamp. Factory helpers on Error include FromException, Validation, NotFound, Conflict, Unauthorized, etc., so call sites do not hand-roll severity/type for common cases. Validation-specific codes often flow through ValidationErrorCodes.

Concepts — Void and non-data success

  • ResultVoid / patterns for “operation completed, no payload” live alongside Result<T> (see ResultVoid.cs usage in your solution).
  • Unit represents a typed “no value” placeholder where APIs want Result<Unit>.

Concepts — Option<T>

Optional presence without conflating “failed operation” with “no value”. Distinct from Result: use Option when absence is not an error (e.g. optional query row).

Concepts — Builders

  • ResultBuilder<T> — fluent WithSuccess / WithFailure / AddError / WithMetadata / Build().
  • BulkResultBuilder — accumulate many item-level outcomes into BulkResult.
  • ErrorBuilder — compose complex Error graphs (nested inner errors, metadata).

Concepts — Request-paired results

  • Result<TRequest, TResult> — extends Result<TResult> with the original TRequest payload, so failure paths can echo back the input that produced the error. Adds TryGetRequest, a four-tuple Deconstruct, and request-aware Success / Failure(Exception, …) factories.
  • BulkResult<TRequest, TResult> — bulk variant whose Results, SuccessfulResults, and FailedResults collections are paired (Result<TRequest, TResult>), plus SuccessfulRequests / FailedRequests projections for re-driving partial failures.
  • BulkResultFromRequest<TRequest, TResult> — a single request that expands into many per-item results (e.g. one upload → many row outcomes), with FromData, FromResults, FromErrors, and FromException helpers.

Concepts — Lists and paging

  • BulkResult<T> — many operations in one round-trip with cached SuccessCount / FailureCount, IsCompleteSuccess / IsCompleteFailure / HasPartialSuccess flags, ErrorCodes / ErrorMessages (flattened over inner errors), SuccessfulData / FailedData, and FromResults / FromData / FromErrors factories.
  • PagedResult — page metadata + items as a Result envelope.

Concepts — Async composition

AsyncResultExtensions provides ThenAsync (chain Task<Result<…>> only on success), OnSuccessAsync / OnFailureAsync, overloads that propagate * *CancellationToken**, and adapters from Task + exceptions into Result. Use these to keep async pipelines linear without nested if (!result.IsSuccess) return … noise.

Concepts — Guards and validation

Ensure and ValidationHelpers express preconditions and collect validation failures into Error / Result shapes (see XML docs on each file).

Concepts — Exception → Result adapters

ExceptionExtensions provides drop-in adapters for exception-throwing code:

Extension Purpose
Exception.ToResult<T>(code?) Wraps an exception as Result<T>.Failure(exception, code).
Task<T>.ToResultAsync<T>(code?) Awaits the task; success → Result<T>.Success, exception → Result<T>.Failure.
Task<Result<T>>.ToResultAsync<T>(code?) Awaits a result-returning task and converts thrown exceptions into a failed Result<T>.

Concepts — Logging

ResultLoggingExtensions attach consistent log scopes for success/failure (OpenTelemetry/correlation-friendly when paired with your logging config).

Concepts — Regex / infrastructure

RegexPatterns hosts shared validation patterns used by higher layers (emails, route slugs, etc.—check call sites before assuming a specific regex is “the” product rule).

Relationship to encryption and HTTP

  • Lyo.Encryption ships EncryptionResult / DecryptionResult models in this namespace for operations that want Result without throwing for routine failure modes.
  • Translation and SMS “envelope” stacks reference Lyo.Result for Error typing in their public models.

When to choose this vs Lyo.Common.Result

  • Prefer Lyo.Result when you need multiple errors, severity/type, bulk/paged wrappers, or async ThenAsync chains.
  • Prefer Lyo.Common primitives when you are only inside code that already standardized on that Result surface and you do not want two result types in the same boundary.

See also

  • Lyo.Validation — often returns structured failures compatible with richer error handling in hosts.
  • Lyo.Exceptions — guard helpers shared with validation and keystore stacks.

Dependencies

Generated from ProjectReference / PackageReference (same model as docs/Lyo.ProjectGraph.html).

  • Lyo.Common — (direct, lyo)
  • Lyo.Exceptions — (direct, lyo)
  • System.Text.Json 10.0.5 — (direct, microsoft, netstandard2.0)
  • Microsoft.Extensions.Logging.Abstractions 10.0.5 — (transitive, microsoft)
  • System.Memory 4.6.3 — (transitive, microsoft, netstandard2.0)
Product Compatible and additional computed target framework versions.
.NET net5.0 was computed.  net5.0-windows was computed.  net6.0 was computed.  net6.0-android was computed.  net6.0-ios was computed.  net6.0-maccatalyst was computed.  net6.0-macos was computed.  net6.0-tvos was computed.  net6.0-windows was computed.  net7.0 was computed.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed.  net8.0 was computed.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed.  net9.0 was computed.  net9.0-android was computed.  net9.0-browser was computed.  net9.0-ios was computed.  net9.0-maccatalyst was computed.  net9.0-macos was computed.  net9.0-tvos was computed.  net9.0-windows was computed.  net10.0 is compatible.  net10.0-android was computed.  net10.0-browser was computed.  net10.0-ios was computed.  net10.0-maccatalyst was computed.  net10.0-macos was computed.  net10.0-tvos was computed.  net10.0-windows was computed. 
.NET Core netcoreapp2.0 was computed.  netcoreapp2.1 was computed.  netcoreapp2.2 was computed.  netcoreapp3.0 was computed.  netcoreapp3.1 was computed. 
.NET Standard netstandard2.0 is compatible.  netstandard2.1 was computed. 
.NET Framework net461 was computed.  net462 was computed.  net463 was computed.  net47 was computed.  net471 was computed.  net472 was computed.  net48 was computed.  net481 was computed. 
MonoAndroid monoandroid was computed. 
MonoMac monomac was computed. 
MonoTouch monotouch was computed. 
Tizen tizen40 was computed.  tizen60 was computed. 
Xamarin.iOS xamarinios was computed. 
Xamarin.Mac xamarinmac was computed. 
Xamarin.TVOS xamarintvos was computed. 
Xamarin.WatchOS xamarinwatchos was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages (32)

Showing the top 5 NuGet packages that depend on Lyo.Result:

Package Downloads
Lyo.Query.Models

Query models for building and representing queries - QueryNode, QueryRequest, ConditionNode, SortBy, builders. Shared by Lyo.Query and Lyo.Api.

Lyo.Encryption

A production-ready .NET encryption library providing secure, authenticated encryption with support for multiple algorithms (AES-GCM, ChaCha20Poly1305, RSA), key management, and envelope encryption patterns.

Lyo.Compression

A production-ready .NET compression library providing efficient, thread-safe compression for the built-in BCL algorithms (GZip, Deflate, and on net10+ Brotli, ZLib). Additional algorithms (LZ4, LZMA, Snappier, Zstd, BZip2, XZ) ship as separate Lyo.Compression.* addon packages so consumers only pay for what they use.

Lyo.Validation

Reusable validators and a fluent builder for validating strongly typed models with structured Result-based failures.

Lyo.Web.Components

Blazor components library for the Lyo web UI framework with MudBlazor integration.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
1.0.2 0 8/19/2026
1.0.1 48 8/18/2026
1.0.0 804 8/16/2026