Expressify 0.1.2-preview1

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

Expressify

Expressify is a C# library that allows you to turn ordinary expresion body methods into expression trees that can be used with IQueryable LINQ queries or any ORM that supports expressions. Instead of writing repetitive projection, filtering, or transformation logic manually, you can define methods on your entities or DTOs, mark them with [Expressify], and use them seamlessly in LINQ queries.

Getting Started

Define your entities and DTOs with methods or extension methods that describe the logic you want to reuse in queries using the ExpressifyAttribute.

public class Entity
{
    public Guid Guid { get; set; }
}

public class EntityDto
{
    public Guid Guid { get; set; }

    [Expressify]
    public bool Filter()
        => Guid != Guid.Empty;
}

[Expressify]
internal static class EntityMap
{
    public static EntityDto ToDto(this Entity entity)
        => new { Guid = entity.Guid };
}

Use Expressifier to load load in and use generated expressions in your queries.

var expressifier = new Expressifier(typeof(Test1).Assembly);

[Expressify]
static bool LocalFilter(Entity entity)
    => entity.Filter();

var query = new[]
{
    new Entity { Guid = Guid.NewGuid(), ChildEntity = new ChildEntity { Guid = Guid.Empty } }
}.AsQueryable()
.Where(expressifier, LocalFilter) // Uses the pre-generated expression tree as the filter
.Select(expressifier, EntityMap.ToDto) // Uses the pre-generated expression tree as the projection
.WhereBy(expressifier, x => x.Filter()); // Replaces Filter invocation at runtime with the pre-generated expression tree (slightly slower than passing a static method)

var result = query.ToArray();

DependencyInjection

Expressifier should be a singleton

var expressifier = new Expressifier(typeof(Entity).Assembly);
builder.Services.AddSingleton(expressifier);

Contributing

Contributions are welcome! Open an issue or submit a pull request for bug fixes, feature requests, or improvements.

Product Compatible and additional computed target framework versions.
.NET 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 was computed.  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.
  • 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
0.1.2-preview1 105 2/26/2026
0.1.1 315 11/13/2025