Skip to content
DocsTry Aspire
DocsTry

MilvusBuilderExtensions Methods

ClassMethods7 members
Provides extension methods for adding Milvus resources to the application model.
AddDatabase(IResourceBuilder<MilvusServerResource>, string, string?)Section titled AddDatabase(IResourceBuilder<MilvusServerResource>, string, string?)extensionIResourceBuilder<MilvusDatabaseResource>
Adds a Milvus database to the application model.
public static class MilvusBuilderExtensions
{
public static IResourceBuilder<MilvusDatabaseResource> AddDatabase(
this IResourceBuilder<MilvusServerResource> builder,
string name,
string? databaseName = null)
{
// ...
}
}
builderIResourceBuilder<MilvusServerResource>The Milvus server resource builder.
namestringThe name of the resource. This name will be used as the connection string name when referenced in a dependency.
databaseNamestring?optionalThe name of the database. If not provided, this defaults to the same value as name.
IResourceBuilder<MilvusDatabaseResource>A reference to the ApplicationModel.IResourceBuilder`1.
This method does not actually create the database in Milvus, rather helps complete a connection string that is used by the client component. 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();
AddMilvus(IDistributedApplicationBuilder, string, IResourceBuilder<ParameterResource>, int?)Section titled AddMilvus(IDistributedApplicationBuilder, string, IResourceBuilder<ParameterResource>, int?)extensionIResourceBuilder<MilvusServerResource>
Adds a Milvus container resource to the application model.
public static class MilvusBuilderExtensions
{
public static IResourceBuilder<MilvusServerResource> AddMilvus(
this IDistributedApplicationBuilder builder,
string name,
IResourceBuilder<ParameterResource>? apiKey = null,
int? grpcPort = null)
{
// ...
}
}
builderIDistributedApplicationBuilderThe Hosting.IDistributedApplicationBuilder.
namestringThe name of the resource. This name will be used as the connection string name when referenced in a dependency
apiKeyIResourceBuilder<ParameterResource>optionalThe parameter used to provide the auth key/token user for the Milvus resource.
grpcPortint?optionalThe host port of gRPC endpoint of Milvus database.
IResourceBuilder<MilvusServerResource>A reference to the ApplicationModel.IResourceBuilder`1.
The .NET client library uses the gRPC port by default to communicate and this resource exposes that endpoint. A web-based administration tool for Milvus can also be added using MilvusBuilderExtensions.WithAttu. This version of the package defaults to the tag of the container image. Use in application host
var builder = DistributedApplication.CreateBuilder(args);
var milvus = builder.AddMilvus("milvus");
var api = builder.AddProject<Projects.Api>("api")
.WithReference(milvus);
builder.Build().Run();
WithAttu(IResourceBuilder<T>, Action<IResourceBuilder<AttuResource>>, string?)Section titled WithAttu(IResourceBuilder<T>, Action<IResourceBuilder<AttuResource>>, string?)extensionIResourceBuilder<T>
Adds an administration and development platform for Milvus to the application model using Attu.
public static class MilvusBuilderExtensions
{
public static IResourceBuilder<T> WithAttu<T>(
this IResourceBuilder<T> builder,
Action<IResourceBuilder<AttuResource>>? configureContainer = null,
string? containerName = null)
{
// ...
}
}
builderIResourceBuilder<T>The Milvus server resource builder.
configureContainerAction<IResourceBuilder<AttuResource>>optionalConfiguration callback for Attu container resource.
containerNamestring?optionalThe name of the container (Optional).
IResourceBuilder<T>A reference to the ApplicationModel.IResourceBuilder`1.
This version of the package defaults to the tag of the container image. Use in application host with a Milvus resource
var builder = DistributedApplication.CreateBuilder(args);
var milvus = builder.AddMilvus("milvus")
.WithAttu();
var api = builder.AddProject<Projects.Api>("api")
.WithReference(milvus);
builder.Build().Run();
WithConfigurationBindMount(IResourceBuilder<MilvusServerResource>, string)Section titled WithConfigurationBindMount(IResourceBuilder<MilvusServerResource>, string)extensionIResourceBuilder<MilvusServerResource>
Adds a bind mount for the configuration of a Milvus container resource.
public static class MilvusBuilderExtensions
{
public static IResourceBuilder<MilvusServerResource> WithConfigurationBindMount(
this IResourceBuilder<MilvusServerResource> builder,
string configurationFilePath)
{
// ...
}
}
builderIResourceBuilder<MilvusServerResource>The resource builder.
configurationFilePathstringThe configuration file on the host to mount into the container.
IResourceBuilder<MilvusServerResource>The ApplicationModel.IResourceBuilder`1.
WithConfigurationFile(IResourceBuilder<MilvusServerResource>, string)Section titled WithConfigurationFile(IResourceBuilder<MilvusServerResource>, string)extensionIResourceBuilder<MilvusServerResource>
Copies a configuration file into a Milvus container resource.
public static class MilvusBuilderExtensions
{
public static IResourceBuilder<MilvusServerResource> WithConfigurationFile(
this IResourceBuilder<MilvusServerResource> builder,
string configurationFilePath)
{
// ...
}
}
builderIResourceBuilder<MilvusServerResource>The resource builder.
configurationFilePathstringThe configuration file on the host to copy into the container.
IResourceBuilder<MilvusServerResource>The ApplicationModel.IResourceBuilder`1.
WithDataBindMount(IResourceBuilder<MilvusServerResource>, string, bool)Section titled WithDataBindMount(IResourceBuilder<MilvusServerResource>, string, bool)extensionIResourceBuilder<MilvusServerResource>
Adds a bind mount for the data folder to a Milvus container resource.
public static class MilvusBuilderExtensions
{
public static IResourceBuilder<MilvusServerResource> WithDataBindMount(
this IResourceBuilder<MilvusServerResource> builder,
string source,
bool isReadOnly = false)
{
// ...
}
}
builderIResourceBuilder<MilvusServerResource>The resource builder.
sourcestringThe source directory on the host to mount into the container.
isReadOnlybooloptionalA flag that indicates if this is a read-only mount.
IResourceBuilder<MilvusServerResource>The ApplicationModel.IResourceBuilder`1.
WithDataVolume(IResourceBuilder<MilvusServerResource>, string?, bool)Section titled WithDataVolume(IResourceBuilder<MilvusServerResource>, string?, bool)extensionIResourceBuilder<MilvusServerResource>
Adds a named volume for the data folder to a Milvus container resource.
public static class MilvusBuilderExtensions
{
public static IResourceBuilder<MilvusServerResource> WithDataVolume(
this IResourceBuilder<MilvusServerResource> builder,
string? name = null,
bool isReadOnly = false)
{
// ...
}
}
builderIResourceBuilder<MilvusServerResource>The resource builder.
namestring?optionalThe name of the volume. Defaults to an auto-generated name based on the resource name.
isReadOnlybooloptionalA flag that indicates if this is a read-only volume.
IResourceBuilder<MilvusServerResource>The ApplicationModel.IResourceBuilder`1.