Expressify 0.1.2-preview1
dotnet add package Expressify --version 0.1.2-preview1
NuGet\Install-Package Expressify -Version 0.1.2-preview1
<PackageReference Include="Expressify" Version="0.1.2-preview1" />
<PackageVersion Include="Expressify" Version="0.1.2-preview1" />
<PackageReference Include="Expressify" />
paket add Expressify --version 0.1.2-preview1
#r "nuget: Expressify, 0.1.2-preview1"
#:package Expressify@0.1.2-preview1
#addin nuget:?package=Expressify&version=0.1.2-preview1&prerelease
#tool nuget:?package=Expressify&version=0.1.2-preview1&prerelease
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 | Versions 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. |
-
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 |