Lyo.Query.Evaluation 2.0.0

dotnet add package Lyo.Query.Evaluation --version 2.0.0
                    
NuGet\Install-Package Lyo.Query.Evaluation -Version 2.0.0
                    
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.Query.Evaluation" Version="2.0.0" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Lyo.Query.Evaluation" Version="2.0.0" />
                    
Directory.Packages.props
<PackageReference Include="Lyo.Query.Evaluation" />
                    
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.Query.Evaluation --version 2.0.0
                    
#r "nuget: Lyo.Query.Evaluation, 2.0.0"
                    
#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.Query.Evaluation@2.0.0
                    
#: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.Query.Evaluation&version=2.0.0
                    
Install as a Cake Addin
#tool nuget:?package=Lyo.Query.Evaluation&version=2.0.0
                    
Install as a Cake Tool

Lyo.Query.Evaluation

This slice of the query engine turns a WhereClause into an expression tree and evaluates it. Every IWhereClauseService member is implemented here except caching, which Lyo.Query adds by overriding this package's virtual members.

The split exists because Lyo.Validation needs exactly this and nothing else. Evaluating a ValidationSchema used to mean referencing Lyo.Query, which pulled in cache, encryption, hashing, key store, compression, and health. WhereClauseEvaluator uses a ConcurrentDictionary instead of the shared cache, so a consumer that only wants to know whether an object matches a clause pays for expression building and nothing else.

Metrics are recorded here rather than in Lyo.Query, because Lyo.Metrics has no NuGet dependencies of its own. IMetrics is an optional constructor parameter that defaults to NullMetrics.Instance, so the uninstrumented path costs nothing.

Features

  • In-memory matching. MatchesWhereClause against a compiled predicate.
  • Match explanation. ExplainMatch produces the WhereClauseExplainNode tree that validation turns into errors.
  • Queryable translation. ApplyWhereClause, SortByProperty, and ApplyOrdering against IQueryable<T>.
  • Path resolution. Dotted paths, including collection segments, go through TryValidatePropertyPath and SharedEntityMetadataCache.
  • Value conversion. Filter literals go through IValueConversionService / ValueConversionService, which delegates to TypeConversion.
  • Metrics. Durations, success counters, and errors under Lyo.Query.Constants.Metrics, tagged entity_type. Pass an IMetrics to opt in; omit it and nothing is recorded or allocated.
  • Extension points. GetMatcher, GetEfPredicate, and GetIncludePaths are virtual so a host can plug in its own caching.

Examples

Evaluate a clause without Lyo.Query

using Lyo.Query.Services.ValueConversion;
using Lyo.Query.Services.WhereClause;

IWhereClauseService where = new WhereClauseEvaluator(new ValueConversionService());

var clause = new ConditionClause("Status", ComparisonOperatorEnum.In, new[] { "Open", "Pending" });
if (!where.MatchesWhereClause(order, clause))
    Console.WriteLine(where.ExplainMatch(order, clause).FailureSummary);

Smallest DI wiring

services.TryAddSingleton<IValueConversionService, ValueConversionService>();
services.TryAddSingleton<IWhereClauseService, WhereClauseEvaluator>();

Record metrics without Lyo.Query

using Lyo.Metrics;

// Pass an IMetrics to instrument evaluation. Omitting it uses NullMetrics.Instance.
var metrics = new MetricsService();
IWhereClauseService where = new WhereClauseEvaluator(new ValueConversionService(), metrics);

where.MatchesWhereClause(order, clause);

var successes = metrics.GetCounterValue(
    Lyo.Query.Constants.Metrics.MatchesWhereClauseSuccess,
    tags: [(Lyo.Query.Constants.Metrics.Tags.EntityType, nameof(Order))]);

How this relates to Lyo.Query

Lyo.Query.BaseWhereClauseService subclasses WhereClauseEvaluator and overrides the protected GetMatcher / GetEfPredicate / GetIncludePaths members to go through ICacheService. It also forwards the injected IMetrics only when CacheOptions.EnableMetrics is set, since that flag lives in Lyo.Cache and cannot be read from here. IWhereClauseService signatures are the same either way, so nothing downstream can tell which one it got.

Take this package when the consumer only evaluates clauses. Take Lyo.Query when the consumer wants the shared cache and the rest of the request/paging surface.

netstandard2.0 caveat

On net targets, IWhereClauseService.ExplainMatch ships a default implementation so database-only services need not implement it. netstandard2.0 has no default interface implementations, so the member is abstract there and implementers must supply it.

Dependencies

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

  • Lyo.Common.Core (direct, lyo)
  • Lyo.Exceptions (direct, lyo)
  • Lyo.Metrics (direct, lyo)
  • Lyo.Query.Models (direct, lyo)
  • Lyo.Common.Json (transitive, lyo)
  • Lyo.Common.Metadata (transitive, lyo)
  • Lyo.Parameters (transitive, lyo)
  • Microsoft.Bcl.AsyncInterfaces 10.0.5 (transitive, microsoft, netstandard2.0)
  • System.Memory 4.6.3 (transitive, microsoft, netstandard2.0)
  • System.Text.Json 10.0.5 (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 (3)

Showing the top 3 NuGet packages that depend on Lyo.Query.Evaluation:

Package Downloads
Lyo.Validation

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

Lyo.Query

Query filtering and property comparison services for IQueryable. Uses Lyo.Query.Models for query types.

Lyo.Configuration.Validation

Validates IConfiguration against data-driven ValidationSchema rules: evaluates where-clause constraints directly over configuration keys, or binds a section to a typed options class and validates the bound instance.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
2.0.0 493 9/9/2026