query-pipeline

Explain EF Core LINQ-to-SQL translation across query pipeline stages.

14.8k|3.4k|Updated Jan 23, 2014
One-click install
npx skills add https://github.com/dotnet/efcore --skill query-pipeline
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: query-pipeline
Source: https://github.com/dotnet/efcore/tree/main/.agents/skills/query-pipeline
Command: npx skills add https://github.com/dotnet/efcore --skill query-pipeline

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

EF Core developers need a clear guide to how LINQ queries are translated into SQL and how the query pipeline coordinates preprocessing, translation, postprocessing, compilation, and SQL generation.

Core Features & Use Cases

  • Detailed stages: Preprocessing, Translation, Postprocessing, Compilation, and SQL Generation.
  • Key components and visitors: NavigationExpandingExpressionVisitor, RelationalSqlTranslatingExpressionVisitor, QuerySqlGenerator, ShaperProcessingExpressionVisitor, and related classes.
  • Validation and debugging guidance: ToQueryString, ExpressionPrinter, and provider test expectations to verify correctness.

Quick Start

Follow this guide to understand the EF Core query translation pipeline before extending it.

Frequently Asked Questions about query-pipeline

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How does EF Core translate LINQ to SQL?

EF Core translates LINQ to SQL through a query pipeline spanning preprocessing, translation, postprocessing, compilation, and SQL generation stages to produce executable SQL.

How do I debug EF Core LINQ query translation issues?

Debug LINQ query translation by inspecting expression trees with ExpressionPrinter and emitting generated SQL via ToQueryString to verify correctness during the translation pipeline stages.

What is the role of expression visitors in EF Core SQL generation?

Expression visitors like NavigationExpandingExpressionVisitor and RelationalSqlTranslatingExpressionVisitor process expression trees during translation to shape the final SQL generation output.

How do I extend the EF Core query pipeline to modify SQL generation?

Extend the query pipeline by implementing or modifying expression visitors, SqlExpressions, QuerySqlGenerator, or shaper and materialization components across the translation and compilation stages.

Can I use ToQueryString to verify EF Core LINQ translation correctness?

Yes, ToQueryString emits the generated SQL from a LINQ query, allowing you to verify translation correctness and debug the query pipeline output during development.

What are the limitations when modifying EF Core expression visitors?

Modifying expression visitors requires validating correctness against provider tests, as changes to preprocessing, translation, or postprocessing stages directly impact SQL generation and shaper behavior.