iTechGuides is reader-supported. When you buy through links on our site, we may earn an affiliate commission. As an Amazon Associate I earn from qualifying purchases. Learn more
For the documented EF Core vector workflow, your app needs EF Core 10 or later and SQL Server 2025 or later; Microsoft also identifies Azure SQL Database as supporting vector data in EF Core 10. Check the app’s actual provider and deployment database before changing its schema. Then persist one embedding per retrievable text chunk, retrieve lexical and semantic candidates, and combine their rankings when both exact-term matching and paraphrase recall matter.
Check compatibility before changing the data model
Microsoft says vector support was introduced in EF Core 10.0 and is supported by the SQL Server provider only with SQL Server 2025 and above. EF Core 10 release notes also identify Azure SQL Database for vector data and VECTOR_DISTANCE() support. Confirm the deployed database engine as well as the EF Core version and provider: a compatible development setup does not establish that a production target can use the same vector workflow. Microsoft’s SQL Server EF Core vector-search documentation and EF Core 10 release notes describe the version boundary.
- Inventory the app’s .NET and EF Core versions, EF Core provider, SQL Server or Azure SQL deployment target, and migration process.
- Identify how the app currently searches. Keep existing full-text or other lexical search if exact names, identifiers, or phrases are important.
- Make database compatibility a gate: do not add a vector property until the deployment target supports the intended mapping and query path.
Model chunks and persist dimension-matched embeddings
Represent retrievable text as stable records
A practical design is a chunk record linked to its source document, with a stable chunk ID, text, useful metadata, and an embedding. Stable IDs let retrieval results from different search methods refer to the same chunk. This is an application design recommendation; Microsoft’s vector documentation explains the vector mapping, not a required chunk schema.
Map an embedding property of type SqlVector<float> to a SQL vector(n) column. Set n to the output dimension of the embedding model you actually select. Microsoft uses vector(1536) as an example, not as a universal dimension requirement. The embedding model, column dimension, and generated vectors must agree.
#1 Best Overall
Generate vectors as content changes
Create or refresh a chunk’s embedding when that chunk’s text changes; generate a query embedding when a user submits a search. Microsoft points to the Microsoft.Extensions.AI IEmbeddingGenerator abstraction and demonstrates GenerateVectorAsync. The provider and model are application choices, not prescribed by the SQL Server provider documentation. Track enough source and version metadata to know which document and embedding process produced a stored chunk, and make refresh behavior explicit when documents or model choices change.
Choose chunk boundaries for your corpus
The cited Microsoft pages do not prescribe chunk size, overlap, metadata fields, or a particular embedding model. Split content at meaningful boundaries for the material and queries your app serves; preserve identifiers and context needed to interpret a chunk. Test alternatives on representative questions rather than treating an arbitrary token count or overlap as an official default.
Rank #2
Choose exact or approximate vector retrieval
Use exact distance as a baseline
EF.Functions.VectorDistance() computes distance against rows and can be used to order candidates by their distance from a query vector. This is a straightforward baseline for validating that stored embeddings and query generation work together. Microsoft notes that exact searches scan rows and can become slow at scale, so measure latency on the application’s workload rather than assuming it will remain suitable as the corpus grows.
Use indexed approximate search only when its trade-off fits
For approximate nearest-neighbor retrieval, Microsoft documents creating a vector index and using WithApproximate() after Take(). The approach trades exactness for performance; compare its results and latency with the exact baseline using representative queries. Microsoft labels VECTOR_SEARCH() and vector indexes experimental and subject to change, so verify current product and EF Core documentation before relying on them in production.
The vector-index documentation lists cosine, Euclidean, and dot metrics. It notes cosine is commonly used for text embeddings, but that is not a guarantee that cosine is right for every model. Follow the selected model’s guidance and validate the metric against retrieval quality for your data.
Combine lexical and semantic results with hybrid ranking
Lexical search is valuable when a query contains a precise term, name, or identifier. Vector search can retrieve semantically related text even when the wording differs. If the application needs both behaviors, retrieve a bounded candidate set from each method, unify duplicate hits by stable chunk ID, and fuse their ranks.
Rank #4
- Run lexical retrieval—for example, Microsoft’s EF pattern uses
FreeTextTable()—and retain a bounded set of chunk IDs and ranks. - Generate the query embedding and retrieve a bounded semantic candidate set through
VectorSearch(). - Combine the candidate lists by stable chunk ID so a chunk found by both methods is represented once.
- Calculate a Reciprocal Rank Fusion (RRF) score from each candidate’s rank in the lexical and semantic lists, then return the desired top results.
Microsoft demonstrates a single EF query pattern combining FreeTextTable(), VectorSearch(), and RRF. Candidate counts and ranking choices are workload decisions: tune them with the app’s corpus and query types rather than treating the example as a universal quality setting.
Recommended Free Tools
Validate retrieval before expanding the rollout
Build a small evaluation set from questions users are likely to ask. Include both exact-name or identifier queries and paraphrased questions, then compare lexical-only, exact-vector, approximate-vector where available, and hybrid results. Check whether the useful chunk appears near the top, whether duplicate candidates are handled correctly, and how query latency changes. Use these results to adjust chunking, candidate limits, filters, and ranking. The Microsoft documentation supplies implementation patterns, not universal relevance targets or performance benchmarks.
Quick Recap
Best Value
- Verify vectors have the model’s expected dimension and that the query vector uses a compatible model and dimension.
- Check that refreshed source text has corresponding refreshed chunks and embeddings.
- Test exact search separately before introducing an experimental approximate index path.
- Confirm production database compatibility and current support status before deployment.
Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.

