Skip to content

Search EricksonLopez.* Ecosystem

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

Configuration & Adapters — SQL, EF Core, Dapper, MongoDB & Result

L1StableNuGet: v2.0.0Local HEAD: v3.0.0AOT: Partial
using EricksonLopez.Specification;
using EricksonLopez.Specification.PostgreSql;
using EricksonLopez.Specification.Sql;
namespace Example.SpecificationSql;
public sealed record OrderRow(int Id, string Status);
public static class OrderSqlExample
{
public static SqlQuery TranslateActiveOrders()
{
var query = QuerySpec<OrderRow>.Empty
.Where(Spec.For<OrderRow>(static o => o.Status == "Active"))
.Page(1, 25);
var translator = new QuerySpecTranslator<OrderRow>(
"orders",
SnakeCaseColumnNameResolver.Default);
QueryModel model = translator.Translate(query);
return PostgreSqlDialect.Default.Render(model);
}
}
  • EF Core (Specification.EntityFrameworkCore): services.AddSpecificationEntityFramework(...), services.AddEfReadRepository<T>(...), dbContextOptionsBuilder.UseSpecification(...), EfReadRepository<TEntity>, EfSpecificationEvaluator.
  • LINQ (Specification.Linq): queryable.Apply(querySpec).
  • MongoDB (Specification.MongoDB): MongoReadRepository<TDocument>, MongoSpecificationEvaluator.
  • Result (Specification.Result): ReadRepositoryResultExtensions (ListResultAsync, FirstOrDefaultResultAsync, SingleOrDefaultResultAsync, GetByIdResultAsync).
  • Source Generators (Specification.Generators): [Spec] and [SpecColumnResolver(NamingConvention.SnakeCase)].