This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
await using var context = new BlogContext(); | |
await context.Database.EnsureDeletedAsync(); | |
await context.Database.EnsureCreatedAsync(); | |
using var ctx = new BlogContext(); | |
var services = new ServiceCollection() | |
.AddEntityFrameworkDesignTimeServices() | |
.AddDbContextDesignTimeServices(ctx); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using System.IO; | |
using System.Runtime.InteropServices; | |
using Microsoft.Data.Sqlite; | |
const string PATH = "/tmp/foo.sqlite"; | |
File.Delete(PATH); | |
await using var connection = new SqliteConnection($"Data Source={PATH}"); | |
connection.LoadVector(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using System.Collections.Generic; | |
using System.Threading; | |
using System.Threading.Tasks; | |
// Note: QdrantVectorStoreClient is a thing I shoved in which basically wraps a typical vector DB client. | |
// In this sketch, it implements IVectorCollectionStore (which can be seen as a view over the SDK client's capabilities) | |
{ | |
// Super basic, non-DI usage scenario, no database-specific options |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
await using var context = new BlogContext(); | |
await context.Database.EnsureDeletedAsync(); | |
await context.Database.EnsureCreatedAsync(); | |
public class BlogContext : DbContext | |
{ | |
public DbSet<Blog> Blogs { get; set; } | |
protected override void ConfigureConventions(ModelConfigurationBuilder configurationBuilder) | |
=> configurationBuilder.Properties<ReadOnlyMemory<byte>>().HaveConversion<ReadOnlyMemoryConverter>(); |