Skip to content

Prepare Pgvector.EntityFrameworkCore 0.4.0-rc.1 for EF Core 11 - #64

Closed
roji wants to merge 1 commit into
pgvector:masterfrom
roji:roji-pgvector-ef-11-convention
Closed

roji wants to merge 1 commit into
pgvector:masterfrom
roji:roji-pgvector-ef-11-convention

Conversation

@roji

@roji roji commented Oct 16, 2026 •

Copy link
Copy Markdown
Contributor

@ankane, following your preference in #63, this prepares Pgvector.EntityFrameworkCore 0.4.0-rc.1 for .NET 11 and EF Core 11, including the convention to stop auto-loading vector columns. This is a release candidate because EF Core 11 has not yet been released.

Closes #59

Summary

  • Set Pgvector.EntityFrameworkCore to version 0.4.0-rc.1, targeting net11.0 only, with Npgsql.EntityFrameworkCore.PostgreSQL 11.0.0-rc.1.1.
  • Register an IConventionSetPlugin using EF 11's AutoLoadConvention to exclude Vector, HalfVector, and SparseVector properties from automatic entity loading by default. Explicit model configuration takes precedence; BitArray behavior is unchanged.
  • Move design-time registration targets to build/net11.0, update the SDK/CI configuration, and document explicit projections and model-level opt-in via Metadata.IsAutoLoaded = true.
  • Cover generated SQL, tracked/untracked materialization, vector filtering/ordering and distance queries, explicit projections, preservation of unloaded vectors during unrelated updates, and explicit auto-loading overrides.

Rebased directly onto the latest upstream master. This PR no longer depends on #63 and does not include the proposed EF 10 release. For EF Core 9 and 10, the README continues to recommend version 0.3.0.

Lower-level Pgvector and Pgvector.Dapper versions, target frameworks, and dependency policies are unchanged. Per-query auto-loading opt-in is out of scope.

Validation

  • All 18 focused EF tests passed after rebasing against local PostgreSQL 18.4 using .NET SDK 11.0.100-rc.2.26504.105.
  • Packed Pgvector.EntityFrameworkCore.0.4.0-rc.1.nupkg successfully; verified version 0.4.0-rc.1, the EFCore.PG 11 dependency, and only lib/net11.0 and build/net11.0 assets.
  • An isolated package consumer verified the convention, generated design-time services reference, and design-time mapping/code-generation registration.

No packages were published.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Copilot-Session: ae01fae1-3e57-4d55-ad2c-f746a2d1084d
@roji
roji force-pushed the roji-pgvector-ef-11-convention branch from fb05a0e to 4616510 Compare October 23, 2026 10:05
@roji roji changed the title Prepare Pgvector.EntityFrameworkCore 11.0.0 and disable vector auto-loading by default Prepare Pgvector.EntityFrameworkCore 0.4.0-rc.1 for EF Core 11 Oct 23, 2026
@roji

roji commented Oct 23, 2026

Copy link
Copy Markdown
Contributor Author

@ankane as discussed in #63, here's the PR updating to version 0.4.0-rc.1, and taking a dependency on EF and EFCore.PG 11.0.0.

ankane added a commit that referenced this pull request Oct 24, 2026
… SparseVector properties - #64

Co-authored-by: Shay Rojansky <roji@roji.org>
Assisted-by: Copilot App
@ankane ankane closed this in 8661362 Oct 24, 2026
@ankane

ankane commented Oct 24, 2026

Copy link
Copy Markdown
Member

Thanks @roji! Merged in the two commits above (one to support IsAutoLoaded and the other to change the default value).

@ankane

ankane commented Oct 24, 2026

Copy link
Copy Markdown
Member

Also, fwiw, EF Core doesn't set the properties even when the query returns them (which doesn't seem great).

var items = await ctx.Items.FromSql($"SELECT * FROM efcore_items ORDER BY embedding <-> {embedding} LIMIT 5").ToListAsync();
Assert.Null(items[0].Embedding);

@roji

roji commented Oct 24, 2026

Copy link
Copy Markdown
Contributor Author

Thanks!

Yeah, that seems like a bug on the EF Side - opened dotnet/efcore#39398.

@ankane

ankane commented Oct 24, 2026

Copy link
Copy Markdown
Member

Awesome, thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add convention plugin to configure vector properties as not auto-loaded

2 participants