eQuantic.Linq.Expressions
3.7.1
dotnet add package eQuantic.Linq.Expressions --version 3.7.1
NuGet\Install-Package eQuantic.Linq.Expressions -Version 3.7.1
<PackageReference Include="eQuantic.Linq.Expressions" Version="3.7.1" />
<PackageVersion Include="eQuantic.Linq.Expressions" Version="3.7.1" />
<PackageReference Include="eQuantic.Linq.Expressions" />
paket add eQuantic.Linq.Expressions --version 3.7.1
#r "nuget: eQuantic.Linq.Expressions, 3.7.1"
#:package eQuantic.Linq.Expressions@3.7.1
#addin nuget:?package=eQuantic.Linq.Expressions&version=3.7.1
#tool nuget:?package=eQuantic.Linq.Expressions&version=3.7.1
eQuantic.Linq.Expressions
Convert any .NET expression tree into a fully structured, serialization-friendly model (JSON) — and rebuild the exact expression back, with full fidelity.
Expression<Func<Order, bool>> ⇄ ExpressionNode model ⇄ JSON
- 84 of 85
ExpressionTypevalues round-trip with structural fidelity (onlyDynamicis impossible by design) — binaries, unaries, calls, members, initializers, anonymous types, blocks, loops, switch, try/catch, labels and gotos. - The complete
Queryablesurface (all 63 operators on .NET 10, includingLeftJoin,CountBy,AggregateBy,Shuffle) serialized as wholeIQueryablepipelines — query root included, re-bindable on the other side. - Closures handled: captured locals,
thisreferences and compiler display classes fold into portable constants before serialization. - Anonymous types travel: projections are described structurally and re-materialized with matching equality semantics (safe for
GroupBy/Distinctkeys). - Targets
netstandard2.0,net8.0andnet10.0.
Quick start
using eQuantic.Linq.Expressions;
Expression<Func<Order, bool>> filter = o => o.Total > minimum && o.Items.Any(i => i.Price > 50m);
string json = ExpressionSerializer.Default.ToJson(filter);
// …transport, store, audit…
var rebuilt = ExpressionSerializer.Default.FromJson<Func<Order, bool>>(json);
The typed model — ExpressionModel<TRoot>
Anchor the payload on a root entity and everything below it is inferred — parameter types, member owners, constant types, generic method arguments. Payloads become lean enough to write by hand:
{
"body": {
"$type": "binary",
"nodeType": "GreaterThan",
"left": { "$type": "member", "member": { "name": "total" }, "expression": { "$type": "parameter" } },
"right": { "$type": "constant", "value": 100 }
}
}
Expression<Func<Order, bool>> predicate = ExpressionModel<Order>.FromJson(json).ToPredicate();
Member and method names match case-insensitively (including [Column("…")] fallback), enum
constants accept strings, and instance-style extension calls (items.Any(…)) are bound by generic
unification.
DTO → entity casting
Rewrite expressions authored over the API shape onto the data model — with computed mappings:
using eQuantic.Linq.Expressions.Casting;
var cast = ExpressionCast.Create<OrderDto, Order>(o => o
.Map(d => d.CustomerName, e => e.Customer.Name)
.Map(d => d.Revenue, e => e.Items.Sum(i => i.Price * i.Quantity))
.Nested<ItemDto, OrderItem>(n => n.Map(i => i.Cost, e => e.Price)));
Expression<Func<Order, bool>> where = cast.Predicate(dtoPredicate);
Composition & helpers
Provider-friendly predicate composition (parameters rebound — no Invoke), member-path bridging
and model-direct querying:
var filter = PredicateBuilder.True<Order>()
.AndAlso(o => o.Total > 100m)
.AndAlso(o => o.Customer.IsVip); // also Or/OrElse/Not/Compose
var path = selector.GetMemberPath(); // o => o.Customer.Name → "Customer.Name"
var back = MemberPathExtensions.ToSelector<Order>("customer.name"); // string path → typed lambda
db.Orders.Where(model) // ExpressionModel<Order> straight onto IQueryable
.OrderByPath("customer.name").ThenByPath("total", descending: true);
NullGuards.Apply(predicate) (or predicate.WithNullGuards()) rewrites deep member chains with
C# ?.-style protection for LINQ-to-objects execution.
Security & performance
- One-liner hardening for untrusted payloads:
ExpressionSerializer.CreateSecure(typeof(Order), …)— strict type resolution locked to your contract types, a method allow-list, and tightened depth/node/anonymous-type caps. Fine-grained policies viaTypeResolutionOptionsandMethodFilter. - Nothing executes at deserialization time — decoding only resolves types/members and assembles an inert tree.
- Process-wide reflection caches, interpreter-based closure folding, compiled anonymous-type accessors and deterministic overload binding keep hot paths reflection-free and reproducible.
Learn more
Educational guides (concepts, hand-written payloads, internals, FAQ): getting started · the model & inference · DTO casting · security · extensions · how it works
MIT © eQuantic Tech
| Product | Versions 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 is compatible. 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. |
-
.NETStandard 2.0
- System.Reflection.Emit (>= 4.7.0)
- System.Text.Json (>= 10.0.0)
-
net10.0
- No dependencies.
-
net8.0
- System.Text.Json (>= 10.0.0)
NuGet packages (7)
Showing the top 5 NuGet packages that depend on eQuantic.Linq.Expressions:
| Package | Downloads |
|---|---|
|
eQuantic.Core.Data
eQuantic Core Data Class Library |
|
|
eQuantic.Linq
The eQuantic.Linq engine as a single reference: a meta-package that brings in eQuantic.Linq.Expressions (expression ⇄ JSON serialization, inference, casting), eQuantic.Linq.Web (query-string syntax and typed builders) and eQuantic.Linq.Specification (the specification pattern). Framework-free core — the ASP.NET Core / Swagger / OpenAPI integrations remain opt-in packages. |
|
|
eQuantic.Core.Data.MongoDb
Native MongoDB implementation of the eQuantic.Core.Data contracts — the MongoDB Driver directly, no Entity Framework, with first-class document-store migrations. |
|
|
eQuantic.Linq.Web
REST-friendly query-string syntax for eQuantic.Linq.Expressions: parse filters (property:op(value), and/or/not, any/all, aggregates, method segments), sorting, paging and anonymous projections from URLs into fully typed LINQ expression trees — with DTO→entity casting support. |
|
|
eQuantic.Linq.Specification
Specification pattern for LINQ: composable specifications (And/AndAlso/Or/OrElse/Not with expression parameter rebinding, operator overloads) plus ExpressionModelSpecification, which materializes serialized eQuantic.Linq.Expressions models — or their raw JSON — into typed predicates. |
GitHub repositories
This package is not used by any popular GitHub repositories.
First preview: full-fidelity expression⇄JSON serialization (84/85 ExpressionTypes, all 63 Queryable operators), root-anchored ExpressionModel<TRoot> with type inference, strict type-resolution security, DTO→entity ExpressionCast with computed maps and column fallback.