Class EdgeVectorDataBuilderExtensions
- Namespace
- Qavren.Edge.VectorData
- Assembly
- Qavren.Edge.VectorData.dll
Registers the vector store, its collections and their schema on the Qavren.Edge builder.
public static class EdgeVectorDataBuilderExtensions
- Inheritance
-
EdgeVectorDataBuilderExtensions
- Inherited Members
Methods
- AddVectorCollectionMigration(EdgeBuilder, int, string, VectorStoreCollectionDefinition, string?, Action<EdgeVectorStoreCollectionOptions>?)
The trim/AOT-safe variant: the model is built from the definition with
CollectionModelBuilder.BuildDynamic, which reflects over nothing.
- AddVectorCollectionMigration<TKey, TRecord>(EdgeBuilder, int, string, string?, Action<EdgeVectorStoreCollectionOptions>?)
RECOMMENDED. Emits the collection DDL as a sub-project 1
IEdgeMigration, so the schema is versioned by the existing migrator at startup order 100 withPRAGMA user_versionbookkeeping instead of appearing on first use.
- AddVectorCollection<TKey, TRecord>(EdgeBuilder, string, Action<EdgeVectorStoreCollectionOptions>?, string?)
The ad-hoc alternative: an
IEdgeStartupTaskat order 300 callingEnsureCollectionExistsAsync. Same SQL, no version bookkeeping.Known limitation, unresolved as of 2026-09-11. A task running inside the startup sequence cannot open a database connection:
IEdgeDatabase.OpenConnectionAsyncawaitsIEdgeHost.EnsureStartedAsync, and that barrier only lifts once every startup task - including this one - has returned, so the host deadlocks. Sub-project 1 solves this for its own order-10 and order-100 tasks with aninternalEdgeDatabase.OpenCoreAsync, which this package cannot reach. Until sub-project 1 exposes a startup-safe open, use AddVectorCollectionMigration<TKey, TRecord>(EdgeBuilder, int, string, string?, Action<EdgeVectorStoreCollectionOptions>?) (the recommended path anyway) or callEnsureCollectionExistsAsyncyourself after the host has started.
- AddVectorStore(EdgeBuilder, Action<EdgeVectorStoreOptions>?)
Registers EdgeVectorStore and MEVD's
VectorStoreover the named sub-project 1 database, plus the diagnostics contributor and the lifecycle observer.Embedding generator resolution, which is what makes the four-call path work. The registered factory resolves IEmbeddingGenerator from the container with
GetService- neverGetRequiredService, because a store used only with pre-computed ReadOnlyMemory<T> vectors needs no generator and demanding one would break that. The result goes to EdgeVectorStore'sembeddingGeneratorparameter, which applies it only where EmbeddingGenerator is still null.The query generator is then resolved from the generator itself, by service key, with no reference to
Qavren.Edge.Embeddings.Onnx: the key is this package's own QueryGeneratorServiceKey, the call isGetServicerather than the ONNX package'sAsQueryGenerator()convenience, and it asks for the non-generic IEmbeddingGenerator - a third-party generator may be typedIEmbeddingGenerator<DataContent, Embedding<float>>, and asking for a closed generic it does not implement would return null and quietly lose the query lane.Builder-call order does not matter, because the factory runs at resolve time.
- AddVectorStore(EdgeBuilder, string, Action<EdgeVectorStoreOptions>?)
Keyed variant. Resolves the keyed IEmbeddingGenerator under the same
namefirst, then the unkeyed one, so a named store pairs with a named generator by convention.