JorgeCostaMacia.ExpressionConverter
5.0.0
Prefix Reserved
dotnet add package JorgeCostaMacia.ExpressionConverter --version 5.0.0
NuGet\Install-Package JorgeCostaMacia.ExpressionConverter -Version 5.0.0
<PackageReference Include="JorgeCostaMacia.ExpressionConverter" Version="5.0.0" />
<PackageVersion Include="JorgeCostaMacia.ExpressionConverter" Version="5.0.0" />
<PackageReference Include="JorgeCostaMacia.ExpressionConverter" />
paket add JorgeCostaMacia.ExpressionConverter --version 5.0.0
#r "nuget: JorgeCostaMacia.ExpressionConverter, 5.0.0"
#:package JorgeCostaMacia.ExpressionConverter@5.0.0
#addin nuget:?package=JorgeCostaMacia.ExpressionConverter&version=5.0.0
#tool nuget:?package=JorgeCostaMacia.ExpressionConverter&version=5.0.0
JorgeCostaMacia.ExpressionConverter
Convert simple LINQ predicate expressions to and from Dictionary<string, string> — handy for serializing filters (query strings, message payloads, storage). Zero dependencies.
Install
dotnet add package JorgeCostaMacia.ExpressionConverter
Usage
using JorgeCostaMacia.ExpressionConverter.Domain;
// Expression -> dictionary
Dictionary<string, string> filter =
ExpressionConverter.Convert<Order>(x => x.Status == "Open" && x.Amount == 100);
// { ["Status"] = "Open", ["Amount"] = "100" }
// dictionary -> expression
Expression<Func<Order, bool>> predicate =
ExpressionConverter.ConvertBack<Order>(filter);
Convert expects equality checks combined with &&, with the property on the left and any expression that evaluates to a value on the right (a literal, a captured variable, a computed value). Values are rendered invariant-culture: enums by name, DateTime in round-trip ("O") format, null as an empty string. ConvertBack rebuilds the predicate, converting each string back to the property's type — including Guid, enums, DateTime and Nullable<T> (an empty string maps to null); an empty dictionary yields an always-true predicate.
Point
ConvertBackat criteria/DTO types, never at entities. When the dictionary crosses a trust boundary (a message payload, a query string), its keys can name any public property ofT— on an entity that would let a caller filter by fields you never meant to expose (a hash, a token) and probe their values. A dedicated criteria type makes its properties the allow-list.
Requirements
One of the following SDKs: .NET 8 / 9 / 10 (.NET 10 recommended).
About
JorgeCostaMacia.ExpressionConverter is part of shared-net — a set of foundational, self-contained .NET packages, each scoped to a single concern and reusable across your bounded contexts.
- Repository: github.com/JorgeCostaMacia/shared-net
- Issues & requests: open an issue
- Contributing: CONTRIBUTING.md
- Security: report a vulnerability
Author: Jorge Costa Maciá
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | 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 is compatible. 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. |
-
net10.0
- No dependencies.
-
net8.0
- No dependencies.
-
net9.0
- No dependencies.
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.
| Version | Downloads | Last Updated |
|---|---|---|
| 5.0.0 | 124 | 7/12/2026 |
| 4.3.0 | 119 | 7/12/2026 |
| 4.2.0 | 120 | 7/11/2026 |
| 4.1.0 | 115 | 7/10/2026 |
| 4.0.0 | 122 | 7/9/2026 |
| 3.0.1 | 115 | 7/8/2026 |
| 2.0.8 | 120 | 7/1/2026 |
| 2.0.7 | 118 | 6/30/2026 |
| 2.0.6 | 103 | 6/30/2026 |
| 2.0.5 | 114 | 6/30/2026 |
| 2.0.4 | 118 | 6/30/2026 |
| 2.0.3 | 114 | 6/29/2026 |
| 2.0.2 | 120 | 6/29/2026 |
| 2.0.1 | 116 | 6/29/2026 |
| 2.0.0 | 139 | 6/29/2026 |
| 1.0.1 | 119 | 6/29/2026 |
| 1.0.0 | 120 | 6/28/2026 |