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
                    
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="JorgeCostaMacia.ExpressionConverter" Version="5.0.0" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="JorgeCostaMacia.ExpressionConverter" Version="5.0.0" />
                    
Directory.Packages.props
<PackageReference Include="JorgeCostaMacia.ExpressionConverter" />
                    
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 JorgeCostaMacia.ExpressionConverter --version 5.0.0
                    
#r "nuget: JorgeCostaMacia.ExpressionConverter, 5.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 JorgeCostaMacia.ExpressionConverter@5.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=JorgeCostaMacia.ExpressionConverter&version=5.0.0
                    
Install as a Cake Addin
#tool nuget:?package=JorgeCostaMacia.ExpressionConverter&version=5.0.0
                    
Install as a Cake Tool

JorgeCostaMacia.ExpressionConverter

Convert simple LINQ predicate expressions to and from Dictionary<string, string> — handy for serializing filters (query strings, message payloads, storage). Zero dependencies.

NuGet Downloads Build License


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 ConvertBack at 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 of T — 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.

Author: Jorge Costa Maciá

Product 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. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
  • 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