Share via


VectorSearchExtensions.GetRequiredService<TRecord> Method

Definition

Asks the IVectorSearchable<TRecord> for an object of the specified type serviceType and throws an exception if one isn't available.

public static object GetRequiredService<TRecord>(this Microsoft.Extensions.VectorData.IVectorSearchable<TRecord> vectorSearch, Type serviceType, object? serviceKey = default);
static member GetRequiredService : Microsoft.Extensions.VectorData.IVectorSearchable<'Record> * Type * obj -> obj
<Extension()>
Public Function GetRequiredService(Of TRecord) (vectorSearch As IVectorSearchable(Of TRecord), serviceType As Type, Optional serviceKey As Object = Nothing) As Object

Type Parameters

TRecord

The record data model to use for retrieving data from the store.

Parameters

vectorSearch
IVectorSearchable<TRecord>

The vector search.

serviceType
Type

The type of object being requested.

serviceKey
Object

An optional key that can be used to help identify the target service.

Returns

The found object.

Exceptions

serviceType is null.

No service of the requested type for the specified key is available.

Applies to