Skip to content

Commit 80be0b8

Browse files
author
fabien.menager
committed
Remove redundant installation page
1 parent 6664984 commit 80be0b8

5 files changed

Lines changed: 69 additions & 114 deletions

File tree

‎docs/.vitepress/config.mts‎

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,6 @@ export default defineConfig({
3939
text: 'Getting Started',
4040
items: [
4141
{ text: 'Introduction', link: '/guide/introduction' },
42-
{ text: 'Installation', link: '/guide/installation' },
4342
{ text: 'Quick Start', link: '/guide/quickstart' },
4443
]
4544
},

‎docs/guide/installation.md‎

Lines changed: 0 additions & 102 deletions
This file was deleted.

‎docs/guide/introduction.md‎

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -95,8 +95,7 @@ LINQ query
9595

9696
## Next Steps
9797

98-
- [Install the packages →](/guide/installation)
99-
- [Follow the Quick Start →](/guide/quickstart)
98+
- [Quick Start →](/guide/quickstart)
10099
- [Constructor Projections →](/guide/projectable-constructors)
101100
- [Analyzers & Code Fixes →](/reference/diagnostics)
102101
- [Learn how it works internally →](/advanced/how-it-works)

‎docs/guide/quickstart.md‎

Lines changed: 66 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,55 @@
11
# Quick Start
22

3-
This guide walks you through a complete end-to-end example — from defining entities with projectable members to seeing the generated SQL.
3+
This guide walks you through a complete end-to-end example — from installing the NuGet packages to seeing the generated SQL.
44

5-
## Step 1 — Define Your Entities
5+
## Prerequisites
6+
7+
- .NET 8 to .NET 10
8+
- EF Core 6 or later (any provider)
9+
10+
## Step 1 — Install the Packages
11+
12+
Projectables is split into **two NuGet packages**:
13+
14+
| Package | Purpose |
15+
|-------------------------------------------------|------------------------------------------------------------------|
16+
| `EntityFrameworkCore.Projectables.Abstractions` | `[Projectable]` attribute + Roslyn source generator + code fixes |
17+
| `EntityFrameworkCore.Projectables` | EF Core runtime interceptor (`UseProjectables()`) |
18+
19+
In most single-project setups both packages go in the same project.
20+
21+
### .NET CLI
22+
23+
```bash
24+
dotnet add package EntityFrameworkCore.Projectables.Abstractions
25+
dotnet add package EntityFrameworkCore.Projectables
26+
```
27+
28+
### Package Manager Console
29+
30+
```powershell
31+
Install-Package EntityFrameworkCore.Projectables.Abstractions
32+
Install-Package EntityFrameworkCore.Projectables
33+
```
34+
35+
### PackageReference (`.csproj`)
36+
37+
```xml
38+
<ItemGroup>
39+
<PackageReference Include="EntityFrameworkCore.Projectables.Abstractions" Version="*" />
40+
<PackageReference Include="EntityFrameworkCore.Projectables" Version="*" />
41+
</ItemGroup>
42+
```
43+
44+
> **Tip:** Replace `*` with the [latest stable version](https://www.nuget.org/packages/EntityFrameworkCore.Projectables/).
45+
46+
## Step 2 — Define Your Entities
47+
48+
Add `[Projectable]` to any property or method whose body you want EF Core to translate to SQL:
649

750
```csharp
51+
using EntityFrameworkCore.Projectables;
52+
853
public class User
954
{
1055
public int Id { get; set; }
@@ -43,7 +88,21 @@ public class Product
4388
}
4489
```
4590

46-
## Step 2 — Enable Projectables on Your DbContext
91+
The source generator runs at **compile time** and emits a companion `Expression<TDelegate>` for each `[Projectable]` member — no runtime reflection.
92+
93+
## Step 3 — Enable Projectables on Your DbContext
94+
95+
Call `UseProjectables()` when configuring your `DbContextOptions`. The extension method is in the `Microsoft.EntityFrameworkCore` namespace and is included in the `EntityFrameworkCore.Projectables` package.
96+
97+
### With DI (`AddDbContext`)
98+
99+
```csharp
100+
services.AddDbContext<AppDbContext>(options =>
101+
options.UseSqlServer(connectionString)
102+
.UseProjectables());
103+
```
104+
105+
### With `OnConfiguring`
47106

48107
```csharp
49108
public class AppDbContext : DbContext
@@ -55,12 +114,12 @@ public class AppDbContext : DbContext
55114
{
56115
optionsBuilder
57116
.UseSqlServer("your-connection-string")
58-
.UseProjectables(); // Enable the runtime interceptor
117+
.UseProjectables();
59118
}
60119
}
61120
```
62121

63-
## Step 3 — Use Projectable Members in Queries
122+
## Step 4 — Use Projectable Members in Queries
64123

65124
Now you can use `GrandTotal`, `Subtotal`, and `Tax` **directly in any LINQ query**:
66125

@@ -86,7 +145,7 @@ var sortedOrders = dbContext.Orders
86145
.ToList();
87146
```
88147

89-
## Step 4 — Check the Generated SQL
148+
## Step 5 — Check the Generated SQL
90149

91150
Use `ToQueryString()` to inspect the SQL EF Core generates:
92151

@@ -98,7 +157,7 @@ var query = dbContext.Orders
98157
Console.WriteLine(query.ToQueryString());
99158
```
100159

101-
The `GrandTotal` property — which itself uses `Subtotal` (which is also `[Projectable]`) — is fully inlined:
160+
The `GrandTotal` property composes `Subtotal` (which is also `[Projectable]`) — both are fully inlined into SQL:
102161

103162
```sql
104163
SELECT [o].[Id], [o].[UserId], [o].[CreatedDate], [o].[TaxRate]

‎docs/index.md‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ hero:
77
tagline: Write properties and methods once — use them anywhere in your LINQ queries, translated to efficient SQL automatically.
88
actions:
99
- theme: brand
10-
text: Get Started
10+
text: Introduction
1111
link: /guide/introduction
1212
- theme: alt
1313
text: Quick Start
@@ -27,7 +27,7 @@ features:
2727

2828
- icon: ⚡
2929
title: Performance-First Design
30-
details: Limited compatibility mode expands and caches queries after their first execution. Subsequent calls skip the expansion step entirely, often outperforming native EF Core.
30+
details: Limited compatibility mode expands and caches queries after their first execution. Subsequent calls skip the expansion step entirely.
3131

3232
- icon: 🔗
3333
title: Composable by Design

0 commit comments

Comments
 (0)