Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions CommunityToolkit.AI.slnx
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
<Project Path="MEVD/src/Qdrant/Qdrant.csproj" />
<Project Path="MEVD/src/Redis/Redis.csproj" />
<Project Path="MEVD/src/SqliteVec/SqliteVec.csproj" />
<Project Path="MEVD/src/SqlServer/SqlServer.csproj" />
<Project Path="MEVD/src/Weaviate/Weaviate.csproj" />
</Folder>
<Folder Name="/MEVD/test/">
Expand All @@ -35,6 +36,8 @@
<Project Path="MEVD/test/Redis.ConformanceTests/Redis.ConformanceTests.csproj" />
<Project Path="MEVD/test/SqliteVec.UnitTests/SqliteVec.UnitTests.csproj" />
<Project Path="MEVD/test/SqliteVec.ConformanceTests/SqliteVec.ConformanceTests.csproj" />
<Project Path="MEVD/test/SqlServer.UnitTests/SqlServer.UnitTests.csproj" />
<Project Path="MEVD/test/SqlServer.ConformanceTests/SqlServer.ConformanceTests.csproj" />
<Project Path="MEVD/test/Weaviate.UnitTests/Weaviate.UnitTests.csproj" />
<Project Path="MEVD/test/Weaviate.ConformanceTests/Weaviate.ConformanceTests.csproj" />
</Folder>
Expand Down
2 changes: 2 additions & 0 deletions Directory.Packages.props
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
<PackageVersion Include="Microsoft.Extensions.VectorData.ConformanceTests" Version="10.5.2" />

<PackageVersion Include="Azure.Search.Documents" Version="11.7.0" />
<PackageVersion Include="Microsoft.Data.SqlClient" Version="6.1.6" />
<PackageVersion Include="Microsoft.Data.Sqlite" Version="10.0.6" />
<PackageVersion Include="MongoDB.Driver" Version="3.7.1" />
<PackageVersion Include="Npgsql" Version="10.0.2" />
Expand Down Expand Up @@ -44,6 +45,7 @@
<PackageVersion Include="Humanizer" Version="3.0.10" />
<PackageVersion Include="Moq" Version="4.20.72" />
<PackageVersion Include="Testcontainers" Version="4.11.0" />
<PackageVersion Include="Testcontainers.MsSql" Version="4.12.0" />
<PackageVersion Include="Testcontainers.PostgreSql" Version="4.11.0" />
<PackageVersion Include="Testcontainers.Qdrant" Version="4.11.0" />
<PackageVersion Include="Testcontainers.Redis" Version="4.11.0" />
Expand Down
3 changes: 3 additions & 0 deletions MEVD/MEVD.slnf
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
"MEVD/src/Qdrant/Qdrant.csproj",
"MEVD/src/Redis/Redis.csproj",
"MEVD/src/SqliteVec/SqliteVec.csproj",
"MEVD/src/SqlServer/SqlServer.csproj",
"MEVD/src/Weaviate/Weaviate.csproj",

"MEVD/test/AzureAISearch.UnitTests/AzureAISearch.UnitTests.csproj",
Expand All @@ -29,6 +30,8 @@
"MEVD/test/Redis.ConformanceTests/Redis.ConformanceTests.csproj",
"MEVD/test/SqliteVec.UnitTests/SqliteVec.UnitTests.csproj",
"MEVD/test/SqliteVec.ConformanceTests/SqliteVec.ConformanceTests.csproj",
"MEVD/test/SqlServer.UnitTests/SqlServer.UnitTests.csproj",
"MEVD/test/SqlServer.ConformanceTests/SqlServer.ConformanceTests.csproj",
"MEVD/test/Weaviate.UnitTests/Weaviate.UnitTests.csproj",
"MEVD/test/Weaviate.ConformanceTests/Weaviate.ConformanceTests.csproj"
]
Expand Down
2 changes: 2 additions & 0 deletions MEVD/src/SqlServer/AssemblyInfo.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
// Licensed to the .NET Foundation under one or more agreements.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

to other code reviewers: microsoft/DacFx#786 was our source of truth, what we needed was to change the license header from // Copyright (c) Microsoft. All rights reserved.

// The .NET Foundation licenses this file to you under the MIT license.
50 changes: 50 additions & 0 deletions MEVD/src/SqlServer/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
# CommunityToolkit.VectorData.SqlServer

SQL Server and Azure SQL provider for [Microsoft.Extensions.VectorData](https://learn.microsoft.com/en-us/dotnet/ai/vector-stores/overview).

## Usage

```csharp
using Microsoft.Extensions.VectorData;
using CommunityToolkit.VectorData.SqlServer;

@adamsitnik adamsitnik Jul 2, 2026

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Another change when compared to microsoft/DacFx#786, the namespace is CommunityToolkit.VectorData.SqlServer rather than Microsoft.SqlServer.VectorData


// Define your record model
public sealed class BlogPost
{
[VectorStoreKey]
public int Id { get; set; }

[VectorStoreData]
public string? Title { get; set; }

[VectorStoreData]
public string? Url { get; set; }

[VectorStoreData]
public string? Content { get; set; }

[VectorStoreVector(Dimensions: 1536)]
public ReadOnlyMemory<float> ContentEmbedding { get; set; }

@westey-m westey-m Jul 2, 2026

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We may want to modernize these examples to use auto embedding generation. See https://learn.microsoft.com/en-us/dotnet/ai/vector-stores/define-your-data-model?tabs=attributes%2Ckey-attribute%2Cdata-attribute%2Cvector-attribute#automatic-embedding-generation-recommended
E.g:

    [VectorStoreVector(Dimensions: 1536)]
    public string ContentEmbedding => Content;

This also requires configuring the vector store with an Embedding Generator, so if too complex for a simple inline example like this, feel free to ignore. And certainly feel free to do this in a follow up PR if you agree with the suggestion.

}

// Create the vector store and get a collection
using SqlServerVectorStore vectorStore = new(connectionString);
var collection = vectorStore.GetCollection<int, BlogPost>("BlogPosts");
await collection.EnsureCollectionExistsAsync();

// Upsert records
await collection.UpsertAsync(new BlogPost
{
Id = 1,
Title = "Vector search in Azure SQL",
Content = "...",
ContentEmbedding = embedding // ReadOnlyMemory<float> from your embedding provider
});

// Search
var results = await collection.SearchAsync(queryEmbedding, top: 5).ToListAsync();
```

## Documentation

- [Vector stores in .NET](https://learn.microsoft.com/en-us/dotnet/ai/vector-stores/overview)
Loading