Skip to sessions and notes

These session notes are AI-generated and may contain mistakes. Verify important details against the original recording.

EF Core 11: Vector Search, Smarter LINQ, and a Friendlier dotnet ef

Jerzy Chinchella

Session · 32:05 recording · 7 min read

At a glance

  • Native vector search: SqlVector, DiskANN vector index, cosine distance
  • Brute-force VectorSearch() vs indexed .WithApproximate() (runtime warning if unindexed)
  • Hybrid search: combining vector similarity with standard relational predicates
  • Vector properties omitted from client entity materialization by default
  • Native SQL Server Full-Text Search in LINQ: FreeTextTable, ContainsTable, ranking & catalogs

Executive Summary

In this in-depth technical session, Jerzy Chinchella from the Entity Framework team presents the major innovations in Entity Framework Core 11 (EF Core 11) shipping with .NET 11. EF Core 11 focuses on three core pillars:

  1. AI & Search Integration: First-class vector search (exact brute-force and indexed approximate nearest neighbor via DiskANN) on relational databases, hybrid querying, non-materialized vector properties by default, and native SQL Server Full-Text Search integration via LINQ.
  2. Smarter LINQ & SQL Generation: Join pruning (automatically eliminating unnecessary INNER JOIN and LEFT JOIN operations when navigation properties are omitted from projections), native LINQ .FullJoin(), .MaxBy(), .MinBy(), and translation of C# collection .Contains() to SQL Server 2025 native JSON_CONTAINS() without OPENJSON overhead.
  3. Modeling, Migrations, and Ergonomics: Indexes on complex properties and JSON sub-fields in Table-per-Type (TPT) and Table-per-Concrete-Type (TPC) hierarchies; unconstrained foreign keys; automatic retry execution strategies on Database.Migrate(); and the new .config/dotnet-ef.json project configuration file that completely removes repetitive CLI flags from dotnet ef.
  4. Provider Enhancements: SQL Server provider targeting Compatibility Level 160 (SQL Server 2022) / 170 (SQL Server 2025) and Microsoft.Data.SqlClient v7; Cosmos DB provider rewrite using Utf8JsonReader and System.Text.Json (retiring __jObject) with transactional batching and atomic rollback; and SQLite support for the IEEE 754 Half float type.

Query Translation Pipeline & Join Pruning Architecture

EF Core 11 enhances the relational expression tree visitor pipeline to evaluate relational dependencies before generating SQL. It detects unused table joins, evaluates database compatibility levels for JSON optimizations, and routes vector searches to appropriate native index constructs.

flowchart TD
    subgraph LINQ ["LINQ Expression Tree"]
        Query["Query: dbContext.Orders.Include(c => c.Customer).Where(...)"]
    end

    subgraph Optimization ["Relational Query Compilation Engine"]
        Analysis["Expression Visitor & Reference Tree Analysis"]
        JoinPruner{"Are Joined Entities<br/>Referenced in Select/Where?"}
        PruneYes["Prune Unused Joins<br/><b>Omit INNER / LEFT JOIN from SQL</b>"]
        PruneNo["Retain Required Joins<br/><b>Generate Necessary SQL Joins</b>"]
        CompLevel{"Database Compatibility Level"}
        CL170["Compat 170 (SQL Server 2025)<br/><b>Translate to JSON_CONTAINS()</b>"]
        CL160["Compat 160 (SQL Server 2022)<br/><b>Standard Table Expansion / OPENJSON</b>"]
    end

    subgraph VectorEngine ["Vector & Full-Text Search Engine"]
        VecCall{"Vector Query Type"}
        Brute["VectorSearch() without WithApproximate<br/><b>Table Scan + Log Runtime Warning</b>"]
        Approx["VectorSearch() + WithApproximate()<br/><b>DiskANN Vector Index Scan</b>"]
        Hybrid["Hybrid Relational + Vector Predicates"]
    end

    subgraph SQLGen ["Native SQL Emission"]
        SQL["Emitted T-SQL Query to Database Provider"]
    end

    Query --> Analysis --> JoinPruner
    JoinPruner -- "Unused in Projection" --> PruneYes --> CompLevel
    JoinPruner -- "Referenced in Projection" --> PruneNo --> CompLevel
    CompLevel -- ">= 170" --> CL170 --> VecCall
    CompLevel -- "< 170" --> CL160 --> VecCall

    VecCall --> Brute --> SQL
    VecCall --> Approx --> SQL
    VecCall --> Hybrid --> SQL

Key Technical Innovations

1. Vector Search & AI Integration

EF Core 11 introduces native vector database operations for storing embeddings and executing similarity queries directly through LINQ.

Model Configuration

public class BlogPost
{
    public int Id { get; set; }
    public string Title { get; set; } = string.Empty;
    public string Content { get; set; } = string.Empty;
    public SqlVector<float> Embedding { get; set; } = default!;
}

// In OnModelCreating:
modelBuilder.Entity<BlogPost>()
    .HasVectorIndex(b => b.Embedding, DistanceMetric.Cosine, IndexType.DiskANN);

Querying: Brute Force vs. Approximate Nearest Neighbor

  • Brute Force: Checking Euclidean or cosine distances across all rows using EF.Functions.VectorSearch(). EF Core emits a runtime warning reminding developers that index acceleration is missing.
  • Approximate Search: Adding .WithApproximate() translates to the database index operator (e.g., DiskANN on SQL Server), achieving orders of magnitude faster execution.
  • Hybrid Search: Combining vector similarity with relational predicates (p.PublishedOn > new DateTime(2026, 1, 1)), enabling targeted search across user scopes or date windows.
  • Bandwidth Optimization: Vector columns (SqlVector<float>) are no longer fetched to the client by default. They remain in the database for search execution unless explicitly selected.

Session Introduction
Session Introduction

Jerzy Chinchella introduces EF Core 11 at .NET Conf 2026.

EF Core 11 Focus Areas
EF Core 11 Focus Areas

Core focus areas: Vector search, AI, smarter LINQ and SQL translations, modeling and migrations.

Vector Search Model Configuration
Vector Search Model Configuration

Configuring SqlVector<float> with cosine distance and DiskANN index.

Vector Search Approximate Query
Vector Search Approximate Query

LINQ queries comparing brute-force VectorSearch, .WithApproximate(), and hybrid relational filtering.

Vector SQL Warning
Vector SQL Warning

EF Core runtime warning alerting the developer that VectorSearch is running unindexed without .WithApproximate().


2. Native Full-Text Search in LINQ

EF Core 11 adds direct LINQ translation for SQL Server Full-Text Search functions:

  • EF.Functions.FreeTextTable(catalog, "search terms")
  • EF.Functions.ContainsTable(catalog, "terms* AND preview")
var query = from p in context.Posts
            join ft in EF.Functions.ContainsTable<BlogPost>("PostCatalog", "AI* AND .NET")
            on p.Id equals ft.Key
            orderby ft.Rank descending
            select new { p.Title, ft.Rank };

Database catalogs and column indexes are declared declaratively via .HasFullTextCatalog() and .HasFullTextIndex(p => new { p.Title, p.Content }).

Full-Text Search ContainsTable
Full-Text Search ContainsTable

Defining full-text catalogs and querying with ContainsTable and FreeTextTable in LINQ.


3. Smarter LINQ & SQL Translations

Automatic JSON_CONTAINS Translation

In SQL Server 2025 (Compatibility Level 170), C# collection operations like list.Contains(item) on primitive JSON collections (List<string>, List<int>) translate directly to the native SQL function JSON_CONTAINS(...) instead of expanding the JSON array into an expensive table value (OPENJSON).

JSON Contains Translation
JSON Contains Translation

LINQ .Contains() mapping directly to SQL Server JSON_CONTAINS under Compatibility Level 170.

Join Pruning (Dead Join Elimination)

When developers write wide queries or use repository methods that join multiple tables (Customer, Coupon, Order), but only project fields from Order:

  • In EF Core 10: Generated SQL performed INNER JOIN on Customer and LEFT JOIN on Coupon, forcing the database optimizer to evaluate joins.
  • In EF Core 11: Join pruning inspects the expression tree and completely omits unneeded joins from the SQL query, dramatically reducing database engine overhead.

Join Pruning in .NET 10 vs 11
Join Pruning in .NET 10 vs 11

EF Core 10 generating unneeded joins for unreferenced entities.

Join Pruning in .NET 11 SQL
Join Pruning in .NET 11 SQL

EF Core 11 pruning unnecessary joins, generating clean and performant single-table SQL.

Additional LINQ Enhancements

  • .FullJoin() extension method natively supported.
  • .MaxBy() and .MinBy() translated to SQL.
  • Direct translation of int.Parse() to CAST(... AS int).
  • Enhanced constructor-bound projection support for Tuple and ValueTuple.

4. Advanced Entity Modeling

  • Complex Properties in TPC & TPT: Complex types and JSON columns can now participate in Table-per-Concrete-Type and Table-per-Type inheritance hierarchies.
  • Complex Property & JSON Indexing: Developers can index nested properties or JSON attributes directly in Fluent API:
    modelBuilder.Entity<Vehicle>()
        .ComplexProperty(v => v.Registration)
        .HasIndex(r => r.Plate);
    
  • Unconstrained Foreign Keys: For event-driven architectures, ETL pipelines, or document stores with loose referential integrity, relationships can be modeled without enforcing foreign key constraints on the database:
    modelBuilder.Entity<Order>()
        .HasOne(o => o.Customer)
        .WithMany()
        .IsConstrained(false);
    
    Optional exclusion from schema generation via .ExcludeForeignKeyFromMigrations().

Complex Type and JSON Indexing
Complex Type and JSON Indexing

Indexing complex properties and JSON attributes inside Table-per-Type (TPT) hierarchies.

Unconstrained Foreign Keys
Unconstrained Foreign Keys

Configuring unconstrained relationships with .IsConstrained(false) for decoupled systems.


5. Ergonomics & dotnet ef Tooling

Project Defaults via .config/dotnet-ef.json

Developers no longer need to type --project src/Data and --startup-project src/Web on every invocation:

{
  "$schema": "http://json.schemastore.org/dotnet-ef-11.0",
  "project": "src/Blog.Data",
  "startupProject": "src/Blog.Web"
}

Now, simply running dotnet ef migrations add Initial automatically discovers and applies the configured paths.

dotnet-ef.json Config File
dotnet-ef.json Config File

Defining default project and startupProject in .config/dotnet-ef.json.

dotnet ef Clean Run
dotnet ef Clean Run

Executing dotnet ef migrations add cleanly without repeating long project flags.

Migration & Runtime Improvements

  • Package Manager Console -NoBuild flag.
  • CLR-only type changes no longer emit redundant ALTER COLUMN statements.
  • Migration bundles support Central Package Management (CPM).
  • Database.Migrate() and Database.EnsureCreated() automatically leverage the configured retry execution strategy (e.g. EnableRetryOnFailure).
  • First-class support for single-file, file-based applications.

6. Provider Upgrades: Cosmos DB, SQL Server, and SQLite

Azure Cosmos DB Provider

  • Transactional Batches: Support for CosmosTransactionalBehavior.WhenNeeded, Always, or Never. Operations within the same partition key commit atomically.
  • Conflict Handling: Atomic rollback on ETag mismatch avoids partial state corruption during concurrent updates.
  • Engine Modernization: Serialization rewritten using Utf8JsonReader and System.Text.Json, retiring Newtonsoft.Json and eliminating the legacy __jObject shadow property.

Cosmos Transactional Batches
Cosmos Transactional Batches

Setting up multi-account financial transfers with Cosmos DB transactional batches.

Cosmos Batch Rollback Demo
Cosmos Batch Rollback Demo

Simulating concurrency collisions: atomic rollback restores consistent account balances.

SQL Server Provider

  • Default compatibility level upgraded to 160 (SQL Server 2022), with opt-in support for 170 (SQL Server 2025).
  • Upgraded to Microsoft.Data.SqlClient v7.

SQLite Provider

  • Added support for the IEEE 754 Half (16-bit float) data type.
  • Dropped .NET Standard 2.0 support (v11 requires .NET 10 or .NET 11+).

Conclusion & Impact

EF Core 11 delivers major performance and developer productivity advancements. By integrating native vector search and Full-Text Search into LINQ, .NET developers can build intelligent AI applications without third-party libraries. With join pruning and JSON_CONTAINS translation, EF Core continues to generate leaner, faster SQL. Finally, developer quality-of-life improvements—such as .config/dotnet-ef.json and Cosmos DB transactional batches—make everyday development smoother, safer, and cleaner.