Mecesoft.Result
1.0.2
dotnet add package Mecesoft.Result --version 1.0.2
NuGet\Install-Package Mecesoft.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="Mecesoft.Result" Version="1.0.2" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Mecesoft.Result" Version="1.0.2" />
<PackageReference Include="Mecesoft.Result" />
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 Mecesoft.Result --version 1.0.2
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#r "nuget: Mecesoft.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 Mecesoft.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=Mecesoft.Result&version=1.0.2
#tool nuget:?package=Mecesoft.Result&version=1.0.2
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
Mecesoft.Result
Lightweight generic Result wrapper for .NET with optional pagination helpers (EF Core friendly).
- Target Framework: .NET 9
- Package: Mecesoft.Result
- License: MIT
Türkçe: .NET için hafif bir Result sarmalayıcısı. İsteğe bağlı sayfalama (pagination) bilgisi taşır ve EF Core ile uyumludur.
Install
NuGet Package Manager:
Install-Package Mecesoft.Result
.NET CLI:
dotnet add package Mecesoft.Result
Quick start
Return success results:
using Mecesoft.Result;
Result<string> ok = Result<string>.Succeed("Hello World");
// or via implicit conversion
Result<string> ok2 = "Hello World";
Return failures:
using Mecesoft.Result;
using System.Net;
var fail1 = Result<string>.Failure((int)HttpStatusCode.BadRequest, "Invalid input");
var fail2 = Result<string>.Failure("Unexpected error");
// or via implicit tuple conversion
Result<string> fail3 = ((int)HttpStatusCode.NotFound, "Not found");
Pagination with EF Core
using Mecesoft.Result;
using Microsoft.EntityFrameworkCore;
// IQueryable source (e.g., DbSet<User>)
var paged = await dbContext.Users
.Where(u => u.IsActive)
.OrderBy(u => u.Id)
.ToPagedListAsync(pageNumber: 1, pageSize: 10, cancellationToken);
// Wrap into a Result
var result = Result<PaginationResult<User>>.Succeed(paged);
// Or return items with separate pagination metadata
var items = paged.Datas; // IList<User>?
var pagination = new PaginationResultBase(paged.PageNumber, paged.PageSize, paged.TotalCount);
var result2 = Result<IList<User>>.Succeed(items!, pagination);
API overview
- Result<T>
- Properties: Data, Pagination, ErrorMessages, IsSuccessful, StatusCode (JsonIgnore)
- Factories: Succeed(...), Failure(...)
- Implicit conversions from T and from (statusCode, errorMessage[s])
- PaginationResultBase: PageNumber, PageSize, TotalPages, TotalCount, IsFirstPage, IsLastPage
- PaginationResult<T>: Datas + all fields above
- IQueryable extension: ToPagedListAsync(pageNumber, pageSize, cancellationToken)
Notes
- StatusCode is ignored during JSON serialization by default (JsonIgnore attribute).
- If pageSize < 1 or pageNumber < 1, sensible defaults are applied (10 and 1 respectively).
License
MIT © 2025 Mecesoft
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net9.0 is compatible. 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 was computed. 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. |
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
-
net9.0
- Microsoft.EntityFrameworkCore (>= 9.0.0)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.