Logo

dev-resources.site

for different kinds of informations.

Semantic search with Azure MS SQL and EF Core

Published at
1/1/2025
Categories
azure
vectordatabase
sql
efcore
Author
chsami
Categories
4 categories in total
azure
open
vectordatabase
open
sql
open
efcore
open
Author
6 person written this
chsami
open
Semantic search with Azure MS SQL and EF Core

In May 2024, the first version of the EFCore.SqlServer.VectorSearch extension was released. This was a significant step towards simplifying vector operations for EF Core users working with Azure SQL.
This plugin is currently in prerelease status, so the APIs and features may evolve before the final release. Here's a quick overview of what it offers.

What Does the Plugin Do?

This plugin bridges EF Core and Azure SQL Database's native vector support, enabling developers to:

  • Perform vector similarity searches using LINQ.
  • insert and retrieve vector data in Azure SQL.
builder.Services.AddDbContext<ProductContext>(options =>
  options.UseSqlServer("<connection string>", o => o.UseVectorSearch()));
Enter fullscreen mode Exit fullscreen mode
protected override void OnModelCreating(ModelBuilder modelBuilder)
{
    modelBuilder.Entity<Product>().Property(p => p.Embedding).HasColumnType("vector(3)");
}
Enter fullscreen mode Exit fullscreen mode
public class Product
{
    public int Id { get; set; }
    public float[] Embedding { get; set; }
}
Enter fullscreen mode Exit fullscreen mode
var someVector = new[] { 1f, 2f, 3f };
var products = await context.Products
    .OrderBy(p => EF.Functions.VectorDistance("cosine", p.Embedding, vector))
    .Take(5)
    .ToArrayAsync();
Enter fullscreen mode Exit fullscreen mode

With this, working with embeddings and vectorized data becomes possible, directly within your EF Core projects.

A full sample using EF Core and vector is available here: https://github.com/Azure-Samples/azure-sql-db-vector-search/tree/main/EF-Core

Azure SQL's Native Vector Support

Since November 2024, Azure SQL Database has been supporting embeddings through its Public Preview of native vector functionality. This development has made it possible to:

  • Store and manage vector data.
  • Perform advanced operations like similarity searches directly in SQL.

For more details, check out the official announcement: Public Preview of Native Vector Support in Azure SQL Database.

Learn more about the vector features in Azure SQL in this guide: Azure SQL Vector Public Preview.

For more details, visit the GitHub repository: EFCore.SqlServer.VectorSearch.

More of this on: https://chsami.com

Happy coding!

vectordatabase Article's
30 articles in total
Favicon
Binary embedding: shrink vector storage by 95%
Favicon
Analyzing LinkedIn Company Posts with Graphs and Agents
Favicon
OpenSearchCon Europe 2025 - Amsterdam!
Favicon
The Best Embedding Models for Information Retrieval in 2025
Favicon
How to Chat with PDFs Using AI via API
Favicon
FalkorDB has integrated with cognee to improve AI-driven knowledge retrieval
Favicon
What Founders Must Do in Agentic LLM Era
Favicon
Vector Databases: Your AI's New Best Friend
Favicon
Vector Database for Modern Applications
Favicon
Introducing VecSpark
Favicon
pg_auto_embeddings — text embeddings directly in Postgres, without extensions
Favicon
Relational Databases Holding You Back?
Favicon
ChromaDB for the SQL Mind
Favicon
Getting started with LLM APIs
Favicon
Understanding Vector Databases: A Beginner's Guide
Favicon
Setup PostgreSQL w/ pgvector in a docker container
Favicon
Simplest markdown component for your AI apps
Favicon
Semantic search with Azure MS SQL and EF Core
Favicon
Announcing 12 Days of Codemas: The DataStax Holiday Giveaway!
Favicon
Enhancing Hybrid Search in MongoDB: Combining RRF, Thresholds, and Weights
Favicon
Serverless semantic search - AWS Lambda, AWS Bedrock, Neon
Favicon
How to integrate pgvector's Docker image with Langchain?
Favicon
Weekly Updates - Dec 20, 2024
Favicon
Generative AI: A Personal Deep Dive – My Notes and Insights
Favicon
Detecting and Analyzing Comment Quality Using Vector Search
Favicon
Choosing a Vector Store for LangChain
Favicon
Elasticsearch Was Great, But Vector Databases Are the Future
Favicon
Introducing Milvus 2.5: Built-in Full-Text Search, Advanced Query Optimization, and More 🚀
Favicon
Migrating Vector Data from Milvus to TiDB
Favicon
How to Create Your Own RAG with Free LLM Models and a Knowledge Base

Featured ones: