Skip to content

feat: add LINQKit and Raffinert expression comparison examples - #5

Merged
ycherkes merged 2 commits into
mainfrom
feat/linqkit-comparison-examples
Aug 30, 2026
Merged

ycherkes merged 2 commits into
mainfrom
feat/linqkit-comparison-examples

Conversation

@ycherkes

Copy link
Copy Markdown
Contributor

Summary

  • Add a .NET 10 / EF Core 10 SQLite console app that implements LINQKit README scenarios in three ways:
    plain EF Core, LINQKit, and Raffinert.Expressions.
  • Compare navigation-collection predicates, correlated subqueries, expression composition, dynamic keyword
    predicates, nested and reusable predicates, generic validity rules, and reusable aggregate projections.
  • Execute all three implementations against the same in-memory database and fail when their results differ.
  • Document the limitations of the plain EF Core implementations where logic must be hardcoded or duplicated.
  • Add runnable Raffinert-specific examples for structural adaptation, typed Then composition,
    MergeBindings, InvokeOrDefault, and MapToExisting.
  • Allow generated SQL to be inspected with the --sql option.
  • Place the sample project in an examples solution folder and link it from the repository README.

Implementation notes

  • Uses Microsoft.EntityFrameworkCore.Sqlite 10.0.11 and LinqKit.Microsoft.EntityFrameworkCore 10.0.11.
  • The original LINQKit README's ad-hoc subquery uses a let projection containing an IQueryable<T>, which
    EF Core 10 rejects. The sample preserves the correlated-subquery behavior while expressing Where(...).Any(...)
    directly inside the outer predicate.
  • “No direct LINQKit equivalent” refers to LINQKit's public API. Custom expression visitors or mapping code could
    reproduce many of the same results, but that additional functionality is not supplied by LINQKit itself.

Verification

  • dotnet build Raffinert.Expressions.slnx --no-restore
  • dotnet test Raffinert.Expressions.slnx --no-build
  • dotnet run --project examples/LinqKitComparison/LinqKitComparison.csproj
  • dotnet run --project examples/LinqKitComparison/LinqKitComparison.csproj --no-build -- --sql

All three query implementations return identical results. The solution builds without warnings or errors, and all
60 tests pass.

@ycherkes
ycherkes merged commit 6e31fdd into main Aug 30, 2026
2 checks passed
@ycherkes
ycherkes deleted the feat/linqkit-comparison-examples branch August 30, 2026 08:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant