Skip to content

Search EricksonLopez.* Ecosystem

Type a library name, NuGet package ID, .NET type, or architectural concept to search across the portal.

Getting Started with EricksonLopez.Specification

dotnet add package EricksonLopez.Specification --version 2.0.0
using System;
using System.Linq.Expressions;
using EricksonLopez.Specification;
namespace Example.Specifications;
public sealed record InvoiceRecord(Guid Id, bool IsPaid, decimal Total, DateTimeOffset IssuedAt);
public sealed class OverdueHighValueInvoiceSpec(decimal minTotal) : Specification<InvoiceRecord>
{
protected override Expression<Func<InvoiceRecord, bool>> BuildExpression() =>
invoice => !invoice.IsPaid && invoice.Total >= minTotal;
}
public static class InvoiceQueryFactory
{
public static QuerySpec<InvoiceRecord> BuildPage(decimal minTotal, int page, int size) =>
new OverdueHighValueInvoiceSpec(minTotal)
.ToQuerySpec()
.OrderByDescending(static i => i.IssuedAt)
.Page(page, size);
}