共用方式為


MilvusBuilderExtensions.AddDatabase Method

Definition

Adds a Milvus database to the application model.

public static Aspire.Hosting.ApplicationModel.IResourceBuilder<Aspire.Hosting.ApplicationModel.MilvusDatabaseResource> AddDatabase (this Aspire.Hosting.ApplicationModel.IResourceBuilder<Aspire.Hosting.Milvus.MilvusServerResource> builder, string name, string? databaseName = default);
static member AddDatabase : Aspire.Hosting.ApplicationModel.IResourceBuilder<Aspire.Hosting.Milvus.MilvusServerResource> * string * string -> Aspire.Hosting.ApplicationModel.IResourceBuilder<Aspire.Hosting.ApplicationModel.MilvusDatabaseResource>
<Extension()>
Public Function AddDatabase (builder As IResourceBuilder(Of MilvusServerResource), name As String, Optional databaseName As String = Nothing) As IResourceBuilder(Of MilvusDatabaseResource)

Parameters

builder
IResourceBuilder<MilvusServerResource>

The Milvus server resource builder.

name
String

The name of the resource. This name will be used as the connection string name when referenced in a dependency.

databaseName
String

The name of the database. If not provided, this defaults to the same value as name.

Returns

A reference to the IResourceBuilder<T>.

Examples

Use in application host

var builder = DistributedApplication.CreateBuilder(args);

var booksdb = builder.AddMilvus("milvus");
  .AddDatabase("booksdb");

var api = builder.AddProject<Projects.Api>("api")
  .WithReference(booksdb);

builder.Build().Run();

Remarks

This method does not actually create the database in Milvus, rather helps complete a connection string that is used by the client component.

Applies to