EntityFrameworkCore.Projectables.Abstractions
6.0.0
dotnet add package EntityFrameworkCore.Projectables.Abstractions --version 6.0.0
NuGet\Install-Package EntityFrameworkCore.Projectables.Abstractions -Version 6.0.0
<PackageReference Include="EntityFrameworkCore.Projectables.Abstractions" Version="6.0.0" />
<PackageVersion Include="EntityFrameworkCore.Projectables.Abstractions" Version="6.0.0" />
<PackageReference Include="EntityFrameworkCore.Projectables.Abstractions" />
paket add EntityFrameworkCore.Projectables.Abstractions --version 6.0.0
#r "nuget: EntityFrameworkCore.Projectables.Abstractions, 6.0.0"
#:package EntityFrameworkCore.Projectables.Abstractions@6.0.0
#addin nuget:?package=EntityFrameworkCore.Projectables.Abstractions&version=6.0.0
#tool nuget:?package=EntityFrameworkCore.Projectables.Abstractions&version=6.0.0
EntityFrameworkCore.Projectables
Flexible projection magic for EF Core
NuGet packages
Starting with V2 of this project we're binding against EF Core 6. If you're targeting EF Core 5 or EF Core 3.1 then you can use the latest v1 release. These are functionally equivalent.
Getting started
- Install the package from NuGet
- Enable Projectables in your DbContext by adding:
dbContextOptions.UseProjectables() - Mark properties, methods, or constructors with
[Projectable]. - Read the documentation for guides, reference, and recipes.
Example
class Order
{
public decimal TaxRate { get; set; }
public ICollection<OrderItem> Items { get; set; }
[Projectable] public decimal Subtotal => Items.Sum(item => item.Product.ListPrice * item.Quantity);
[Projectable] public decimal Tax => Subtotal * TaxRate;
[Projectable] public decimal GrandTotal => Subtotal + Tax;
}
public static class UserExtensions
{
[Projectable]
public static Order GetMostRecentOrder(this User user) =>
user.Orders.OrderByDescending(x => x.CreatedDate).FirstOrDefault();
}
var result = dbContext.Users
.Where(u => u.UserName == "Jon")
.Select(u => new { u.GetMostRecentOrder().GrandTotal })
.FirstOrDefault();
The properties are inlined into SQL — no client-side evaluation, no N+1.
How it works
There are two components: a Roslyn source generator that emits companion Expression<TDelegate> trees for each [Projectable] member at compile time, and a runtime interceptor that walks your LINQ queries and substitutes those expressions before EF Core translates them to SQL.
Features (v6.x+)
| Feature | Docs |
|---|---|
| Properties & methods | Guide → |
| Extension methods | Guide → |
| Constructor projections | Guide → |
| Method overloads | Fully supported |
Pattern matching (switch, is) |
Reference → |
| Block-bodied members (experimental) | Advanced → |
| Null-conditional rewriting | Reference → |
| Enum method expansion | Reference → |
UseMemberBody |
Reference → |
| Roslyn analyzers & code fixes (EFP0001–EFP0012) | Reference → |
| Limited/Full compatibility mode | Reference → |
FAQ
Is this specific to a database provider?
No. The interceptor hooks into EF Core's query compilation pipeline before any provider-specific translation, so it works with SQL Server, PostgreSQL, SQLite, Cosmos DB, and any other EF Core provider.
Are there performance implications?
Two compatibility modes are available: Full (default) expands every query before handing it to EF Core; Limited expands once and caches the result. Limited mode often outperforms plain EF Core on repeated queries. See the Compatibility Mode docs.
Can I compose projectables?
Yes — a [Projectable] member can call other [Projectable] members. They are recursively inlined into the final SQL.
How does this relate to Expressionify?
Expressionify has overlapping features and a similar approach but a narrower scope. Projectables adds constructor projections, pattern matching, block-bodied members, enum expansion, and a richer diagnostics layer.
How does this relate to LinqKit/LinqExpander?
LinqKit and similar libraries predate source generators. Projectables (and Expressionify) are superior approaches for modern .NET because the source generator does the heavy lifting at compile time with no runtime reflection.
What .NET and EF Core versions are supported?
- v1.x → EF Core 3.1 / 5
- v2.x–v3.x → EF Core 6 / 7
- v6.x+ → EF Core 6+ (current; targets
net8.0andnet10.0)
| 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 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. |
-
net10.0
- No dependencies.
-
net8.0
- No dependencies.
NuGet packages (1)
Showing the top 1 NuGet packages that depend on EntityFrameworkCore.Projectables.Abstractions:
| Package | Downloads |
|---|---|
|
EntityFrameworkCore.Projectables
Project over properties and functions in your linq queries |
GitHub repositories
This package is not used by any popular GitHub repositories.
| Version | Downloads | Last Updated |
|---|---|---|
| 6.0.0 | 28 | 3/26/2026 |
| 5.0.2 | 25,199 | 2/13/2026 |
| 5.0.1 | 25,229 | 1/15/2026 |
| 4.1.0-preview.1 | 2,886 | 8/13/2025 |
| 4.0.0 | 791,240 | 12/7/2024 |
| 4.0.0-preview.4 | 66,337 | 8/18/2024 |
| 3.0.4 | 939,574 | 8/30/2023 |
| 3.0.3 | 158,817 | 5/4/2023 |
| 3.0.2 | 133,469 | 3/16/2023 |
| 3.0.1 | 1,323 | 3/9/2023 |
| 3.0.0 | 3,785 | 3/2/2023 |
| 3.0.0-beta.1 | 9,249 | 10/13/2022 |
| 2.3.1-beta.1 | 1,900 | 10/5/2022 |
| 2.3.0 | 108,971 | 8/3/2022 |
| 2.3.0-beta.1 | 282 | 7/8/2022 |
| 2.2.0 | 8,816 | 4/28/2022 |
| 2.1.1 | 6,226 | 1/12/2022 |