Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 0 additions & 5 deletions .agents/skills/analyzers/SKILL.md

This file was deleted.

5 changes: 0 additions & 5 deletions .agents/skills/bulk-operations/SKILL.md

This file was deleted.

5 changes: 0 additions & 5 deletions .agents/skills/cosmos-provider/SKILL.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,6 @@ user-invocable: false

Non-relational provider with its own parallel query pipeline. Uses JSON for document materialization.

## When to Use

- Working on Cosmos SQL generation
- Working on document storage, partition key configuration, or `CosmosClientWrapper`

## Key Differences from Relational

- No migrations — use `EnsureCreated()`
Expand Down
20 changes: 0 additions & 20 deletions .agents/skills/dbcontext-and-services/SKILL.md

This file was deleted.

2 changes: 1 addition & 1 deletion .agents/skills/make-custom-agent/SKILL.md
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ Supported frontmatter fields:
| `target` | No | Target environment: `vscode` or `github-copilot` (defaults to both) |
| `tools` | No | List of allowed tools/tool sets |
| `model` | No | LLM name or prioritized array of models |
| `user-invokable` | No | Show in agents dropdown (default: true) |
| `user-invocable` | No | Show in agents dropdown (default: true) |
| `disable-model-invocation` | No | Prevent subagent invocation (default: false) |
| `mcp-servers` | No | MCP server configs for GitHub Copilot target |
| `metadata` | No | Key-value mapping for additional arbitrary metadata. |
Expand Down
2 changes: 1 addition & 1 deletion .agents/skills/make-skill/SKILL.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ After investigating, verify:
- [ ] Can identify common pitfalls or misconceptions about the topic
- [ ] Can outline a step-by-step skill workflow with clear validation steps
- [ ] Have search queries for deeper topics
- [ ] Can determine if the skill should be user-invokable or background knowledge only
- [ ] Can determine if the skill should be user-invocable or background knowledge only

If there are any ambiguities, gaps in understanding, or multiple valid approaches, ask the user for clarification before proceeding to skill creation.
Also, evaluate whether the task might be better handled by a custom agent, agentic workflow, an existing skill or multiple narrower skills, and discuss this with the user if relevant.
Expand Down
5 changes: 5 additions & 0 deletions .agents/skills/migrations/SKILL.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,11 @@ user-invocable: false

**Apply migration**: `Migrator.MigrateAsync()` → reads `__EFMigrationsHistory` → per pending: `MigrationsSqlGenerator.Generate(operations)` → `MigrationCommandExecutor` executes

## Model Snapshot

- Model snapshots use `typeof(Dictionary<string, object>)` (property bag format), not the actual CLR type. When examining the `ClrType` in a snapshot, don't assume it matches the real entity type.
Comment thread
AndriySvyryd marked this conversation as resolved.
- `SnapshotModelProcessor.Process()` is used at design-time to fixup older model snapshots for backward compatibility.

## Testing

Migration operation tests: `test/EFCore.Relational.Tests/Migrations/`. Functional tests: `test/EFCore.{Provider}.FunctionalTests/Migrations/`. Model differ tests: `test/EFCore.Relational.Tests/Migrations/Internal/MigrationsModelDifferTest*.cs`.
14 changes: 6 additions & 8 deletions .agents/skills/query-pipeline/SKILL.md
Original file line number Diff line number Diff line change
@@ -1,20 +1,18 @@
---
name: query-pipeline
description: 'Implementation details for EF Core LINQ query translation and SQL generation. Use when changing expression visitors, SqlExpressions, QuerySqlGenerator, ShaperProcessingExpressionVisitor, or related classes.'
description: 'Implementation details for EF Core LINQ query translation, SQL generation, and bulk operations (ExecuteUpdate/ExecuteDelete). Use when changing expression visitors, SqlExpressions, QuerySqlGenerator, ShaperProcessingExpressionVisitor, UpdateExpression, DeleteExpression, or related classes.'
user-invocable: false
---

# Query Pipeline

Translates LINQ expressions into database queries and materializes results.

## Stages

1. **Preprocessing** — `QueryTranslationPreprocessor`: `NavigationExpandingExpressionVisitor` (Include, navigations, auto-includes), `QueryOptimizingExpressionVisitor`
2. **Translation** — `QueryableMethodTranslatingExpressionVisitor`: LINQ methods → `ShapedQueryExpression` (= `QueryExpression` + `ShaperExpression`). Relational: `RelationalSqlTranslatingExpressionVisitor`, `SelectExpression`
3. **Postprocessing** — `QueryTranslationPostprocessor`: `SqlNullabilityProcessor`, `SqlTreePruner`, `SqlAliasManager`, `RelationalParameterBasedSqlProcessor`, `SelectExpressionProjectionApplyingExpressionVisitor`, `SqlExpressionSimplifyingExpressionVisitor`, `RelationalValueConverterCompensatingExpressionVisitor`
4. **Compilation** — `ShapedQueryCompilingExpressionVisitor` → executable delegate. Relational: `ShaperProcessingExpressionVisitor` builds shaper and materialization code
5. **SQL Generation** — `QuerySqlGenerator`
1. **Preprocessing**
2. **Translation**
3. **Postprocessing**
4. **Compilation**
5. **SQL Generation**

## Validation

Expand Down
2 changes: 1 addition & 1 deletion .agents/skills/servicing-pr/SKILL.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ description: 'Create EF Core PRs targeting servicing release branches (release/*

# Servicing PRs

PRs targeting `release/*` branches require a specific description format and should include a quirk (AppContext switch) when applicable.
PRs targeting `release/*` branches require a specific description format and should include a quirk (AppContext switch) when applicable. When updating progress on a servicing PR, ensure that the description still follows the template.

## Backport Target Branch

Expand Down
12 changes: 6 additions & 6 deletions .agents/skills/testing/SKILL.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,6 @@ user-invocable: false

# Testing

EF Core test infrastructure, patterns, and workflows for unit, specification, and functional tests.

## Test Categories

### Unit Tests (`test/EFCore.Tests/`, `test/EFCore.Relational.Tests/`, `test/EFCore.{Provider}.Tests/`)
Expand Down Expand Up @@ -67,14 +65,16 @@ Each test gets a fresh model/store. Call `InitializeAsync<TContext>(onModelCreat
## Workflow: Adding New Tests

1. **Specification test**: Add to `EFCore.Specification.Tests` (core) or `EFCore.Relational.Specification.Tests` (relational)
2. **Provider override**: Override in `EFCore.{Provider}.FunctionalTests` with `AssertSql()`
2. **Provider overrides**: Override in **every** provider functional test class (`EFCore.{Provider}.FunctionalTests`) that inherits the base with provider-appropriate assertions.
3. **Unit test**: Add to `EFCore.{Provider}.Tests`
4. Run with `EF_TEST_REWRITE_BASELINES=1` to capture initial baselines
5. When testing cross-platform code (e.g., file paths, path separators), verify the fix works on both Windows and Linux/macOS
5. Run tests with project rebuilding enabled (don't use `--no-build`) to ensure code changes are picked up
6. When testing cross-platform code (e.g., file paths, path separators), verify the fix works on both Windows and Linux/macOS

## Common Pitfalls

| Pitfall | Solution |
|---------|----------|
| SQL or Compiled model baseline mismatch | Set `EF_TEST_REWRITE_BASELINES=1` and re-run |
| `Check_all_tests_overridden` fails | Override new base test in provider test class |
| Baseline mismatch (SQL or compiled model) | Re-run with `EF_TEST_REWRITE_BASELINES=1` |
| `Check_all_tests_overridden` fails | Override the new test in every inheriting provider class |
| SQL Server feature missing at lower compat level | Gate with `[SqlServerCondition(...)]`|
14 changes: 3 additions & 11 deletions .agents/skills/tooling/SKILL.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,23 +10,15 @@ The `dotnet ef` CLI and Visual Studio Package Manager Console commands for migra

## dotnet-ef CLI (`src/dotnet-ef/`)

`RootCommand` parses global options (`--project`, `--startup-project`, `--framework`, `--configuration`, `--runtime`, `--no-build`). Subcommands implemented in `src/ef/Commands/` (`Microsoft.EntityFrameworkCore.Tools.Commands`): `DatabaseCommand`, `DbContextCommand`, `MigrationsCommand`. Each invokes MSBuild to build, then shells out via `dotnet exec ef.dll`, which hosts `OperationExecutor`.
`RootCommand` parses global options. Subcommands implemented in `src/ef/Commands/`. Each invokes MSBuild to build, then shells out via `dotnet exec ef.dll`, which hosts `OperationExecutor`.

## PMC (`src/EFCore.Tools/`)

PowerShell module: `Add-Migration`, `Update-Database`, `Scaffold-DbContext`, `Optimize-DbContext`, etc. Routes to `OperationExecutor`.
PowerShell module: `Add-Migration`, `Update-Database`, `Scaffold-DbContext`, `Optimize-DbContext`, etc.

## MSBuild Tasks (`src/EFCore.Tasks/`)

NuGet package `Microsoft.EntityFrameworkCore.Tasks` provides build/publish-time compiled model and precompiled query generation.

### Build Integration Flow

Targets in `buildTransitive/Microsoft.EntityFrameworkCore.Tasks.targets`:
- **Build flow**: `_EFGenerateFilesAfterBuild` triggers after compilation when `EFOptimizeContext=true` and stage is `build`. Invokes `OptimizeDbContext` task, writes generated file list, re-triggers `Build` to compile new files.
- **Publish flow**: `_EFGenerateFilesBeforePublish` runs before `GeneratePublishDependencyFile`. Auto-activates for `PublishAOT=true`. `_EFPrepareDependenciesForPublishAOT` cascades to project references.
- **Incremental**: `_EFProcessGeneratedFiles` reads tracking files and adds `.g.cs` to `@(Compile)`. Stale files removed by `_EFPrepareForCompile`.
- **Clean**: `_EFCleanGeneratedFiles` deletes generated and tracking files.
NuGet package `Microsoft.EntityFrameworkCore.Tasks` provides build/publish-time compiled model and precompiled query generation. Targets in `buildTransitive/Microsoft.EntityFrameworkCore.Tasks.targets`.

## Testing

Expand Down
6 changes: 2 additions & 4 deletions .agents/skills/update-pipeline/SKILL.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,16 +13,14 @@ Converts tracked entity changes into database INSERT/UPDATE/DELETE commands duri
`SaveChanges()` → `DetectChanges()` → `IDatabase.SaveChanges()`
→ `UpdateAdapter` creates `IUpdateEntry` list
→ `CommandBatchPreparer.BatchCommands()`
→ `ModificationCommand` per entity (maps to table row), composed of `ColumnModification` (maps to column value)
→ `ModificationCommand` per table row, composed of `ColumnModification` per column
→ `SharedTableEntryMap` is used to track entries mapped to the same row
→ Topological sort via Multigraph (FK dependency ordering)
→ Groups into `ModificationCommandBatch` (respects max batch size)
→ `UpdateSqlGenerator` generates SQL per batch
→ `BatchExecutor` executes all batches in a transaction
→ `StateManager.AcceptAllChanges()`

Other Key Files:
- `src/EFCore.Relational/Update/Internal/SharedTableEntryMap.cs` — manages entries mapped to the same row

## Concurrency

Concurrency tokens → WHERE conditions on UPDATE/DELETE. `AffectedCountModificationCommandBatch` checks affected rows. Throws `DbUpdateConcurrencyException` on mismatch.
Expand Down
Loading
Loading