MilvusBuilderExtensions Methods
Class Methods 7 members
Provides extension methods for adding Milvus resources to the application model.
AddDatabase(IResourceBuilder<MilvusServerResource>, string, string?) Section titled AddDatabase(IResourceBuilder<MilvusServerResource>, string, string?) extension IResourceBuilder<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) { // ... }}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? optional The name of the database. If not provided, this defaults to the same value as name. Returns
IResourceBuilder<MilvusDatabaseResource> A reference to the ApplicationModel.IResourceBuilder`1. Remarks
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?) extension IResourceBuilder<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) { // ... }}Parameters
builder IDistributedApplicationBuilder The Hosting.IDistributedApplicationBuilder. name string The name of the resource. This name will be used as the connection string name when referenced in a dependency apiKey IResourceBuilder<ParameterResource> optional The parameter used to provide the auth key/token user for the Milvus resource. grpcPort int? optional The host port of gRPC endpoint of Milvus database. Returns
IResourceBuilder<MilvusServerResource> A reference to the ApplicationModel.IResourceBuilder`1. Remarks
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?) extension IResourceBuilder<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) { // ... }}Parameters
builder IResourceBuilder<T> The Milvus server resource builder. configureContainer Action<IResourceBuilder<AttuResource>> optional Configuration callback for Attu container resource. containerName string? optional The name of the container (Optional). Returns
IResourceBuilder<T> A reference to the ApplicationModel.IResourceBuilder`1. Remarks
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) extension IResourceBuilder<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) { // ... }}Parameters
builder IResourceBuilder<MilvusServerResource> The resource builder. configurationFilePath string The configuration file on the host to mount into the container. Returns
IResourceBuilder<MilvusServerResource> The ApplicationModel.IResourceBuilder`1. WithConfigurationFile(IResourceBuilder<MilvusServerResource>, string) Section titled WithConfigurationFile(IResourceBuilder<MilvusServerResource>, string) extension IResourceBuilder<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) { // ... }}Parameters
builder IResourceBuilder<MilvusServerResource> The resource builder. configurationFilePath string The configuration file on the host to copy into the container. Returns
IResourceBuilder<MilvusServerResource> The ApplicationModel.IResourceBuilder`1. WithDataBindMount(IResourceBuilder<MilvusServerResource>, string, bool) Section titled WithDataBindMount(IResourceBuilder<MilvusServerResource>, string, bool) extension IResourceBuilder<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) { // ... }}Parameters
builder IResourceBuilder<MilvusServerResource> The resource builder. source string The source directory on the host to mount into the container. isReadOnly bool optional A flag that indicates if this is a read-only mount. Returns
IResourceBuilder<MilvusServerResource> The ApplicationModel.IResourceBuilder`1. WithDataVolume(IResourceBuilder<MilvusServerResource>, string?, bool) Section titled WithDataVolume(IResourceBuilder<MilvusServerResource>, string?, bool) extension IResourceBuilder<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) { // ... }}Parameters
builder IResourceBuilder<MilvusServerResource> The resource builder. name string? optional The name of the volume. Defaults to an auto-generated name based on the resource name. isReadOnly bool optional A flag that indicates if this is a read-only volume. Returns
IResourceBuilder<MilvusServerResource> The ApplicationModel.IResourceBuilder`1.