Skip to content
Docs Try Aspire

AspireMicrosoftAzureCosmosExtensions Methods

Class Methods 6 members
Azure Cosmos DB extension
AddAzureCosmosClient(IHostApplicationBuilder, string, Action<MicrosoftAzureCosmosSettings>, Action<CosmosClientOptions>) Section titled AddAzureCosmosClient(IHostApplicationBuilder, string, Action<MicrosoftAzureCosmosSettings>, Action<CosmosClientOptions>) extension
Registers Cosmos.CosmosClient as a singleton in the services provided by the builder. Configures logging and telemetry for the Cosmos.CosmosClient.
public static class AspireMicrosoftAzureCosmosExtensions
{
public static void AddAzureCosmosClient(
this IHostApplicationBuilder builder,
string connectionName,
Action<MicrosoftAzureCosmosSettings>? configureSettings = null,
Action<CosmosClientOptions>? configureClientOptions = null)
{
// ...
}
}
builder IHostApplicationBuilder The Hosting.IHostApplicationBuilder to read config from and add services to.
connectionName string The connection name to use to find a connection string.
configureSettings Action<MicrosoftAzureCosmosSettings> optional An optional method that can be used for customizing the MicrosoftAzureCosmosSettings. It's invoked after the settings are read from the configuration.
configureClientOptions Action<CosmosClientOptions> optional An optional method that can be used for customizing the Cosmos.CosmosClientOptions.
InvalidOperationException If required ConnectionString is not provided in configuration section
Reads the configuration from "Aspire:Microsoft:Azure:Cosmos" section.
AddAzureCosmosContainer(IHostApplicationBuilder, string, Action<MicrosoftAzureCosmosSettings>, Action<CosmosClientOptions>) Section titled AddAzureCosmosContainer(IHostApplicationBuilder, string, Action<MicrosoftAzureCosmosSettings>, Action<CosmosClientOptions>) extension
Registers the Cosmos.Container as a singleton in the services provided by the builder.
public static class AspireMicrosoftAzureCosmosExtensions
{
public static void AddAzureCosmosContainer(
this IHostApplicationBuilder builder,
string connectionName,
Action<MicrosoftAzureCosmosSettings>? configureSettings = null,
Action<CosmosClientOptions>? configureClientOptions = null)
{
// ...
}
}
builder IHostApplicationBuilder The Hosting.IHostApplicationBuilder to read config from and add services to.
connectionName string The connection name to use to find a connection string.
configureSettings Action<MicrosoftAzureCosmosSettings> optional An optional method that can be used for customizing the MicrosoftAzureCosmosSettings. It's invoked after the settings are read from the configuration.
configureClientOptions Action<CosmosClientOptions> optional An optional method that can be used for customizing the Cosmos.CosmosClientOptions.
InvalidOperationException If required ConnectionString is not provided in configuration section
Reads the configuration from "Aspire:Microsoft:Azure:Cosmos" section.
AddAzureCosmosDatabase(IHostApplicationBuilder, string, Action<MicrosoftAzureCosmosSettings>, Action<CosmosClientOptions>) Section titled AddAzureCosmosDatabase(IHostApplicationBuilder, string, Action<MicrosoftAzureCosmosSettings>, Action<CosmosClientOptions>) extension CosmosDatabaseBuilder
Registers the Cosmos.Database as a singleton the services provided by the builder and returns a CosmosDatabaseBuilder to support chaining multiple container registrations against the same database.
public static class AspireMicrosoftAzureCosmosExtensions
{
public static CosmosDatabaseBuilder AddAzureCosmosDatabase(
this IHostApplicationBuilder builder,
string connectionName,
Action<MicrosoftAzureCosmosSettings>? configureSettings = null,
Action<CosmosClientOptions>? configureClientOptions = null)
{
// ...
}
}
builder IHostApplicationBuilder The Hosting.IHostApplicationBuilder to read config from and add services to.
connectionName string The connection name to use to find a connection string.
configureSettings Action<MicrosoftAzureCosmosSettings> optional An optional method that can be used for customizing the MicrosoftAzureCosmosSettings. It's invoked after the settings are read from the configuration.
configureClientOptions Action<CosmosClientOptions> optional An optional method that can be used for customizing the Cosmos.CosmosClientOptions.
InvalidOperationException If required ConnectionString is not provided in configuration section
Reads the configuration from "Aspire:Microsoft:Azure:Cosmos:{name}" section.
AddKeyedAzureCosmosClient(IHostApplicationBuilder, string, Action<MicrosoftAzureCosmosSettings>, Action<CosmosClientOptions>) Section titled AddKeyedAzureCosmosClient(IHostApplicationBuilder, string, Action<MicrosoftAzureCosmosSettings>, Action<CosmosClientOptions>) extension
Registers the Cosmos.CosmosClient as a singleton for given name in the services provided by the builder. Configures logging and telemetry for the Cosmos.CosmosClient.
public static class AspireMicrosoftAzureCosmosExtensions
{
public static void AddKeyedAzureCosmosClient(
this IHostApplicationBuilder builder,
string name,
Action<MicrosoftAzureCosmosSettings>? configureSettings = null,
Action<CosmosClientOptions>? configureClientOptions = null)
{
// ...
}
}
builder IHostApplicationBuilder The Hosting.IHostApplicationBuilder to read config from and add services to.
name string The name of the component, which is used as the ServiceDescriptor.ServiceKey of the service and also to retrieve the connection string from the ConnectionStrings configuration section.
configureSettings Action<MicrosoftAzureCosmosSettings> optional An optional method that can be used for customizing the MicrosoftAzureCosmosSettings. It's invoked after the settings are read from the configuration.
configureClientOptions Action<CosmosClientOptions> optional An optional method that can be used for customizing the Cosmos.CosmosClientOptions.
InvalidOperationException If required ConnectionString is not provided in configuration section
Reads the configuration from "Aspire:Microsoft:Azure:Cosmos:{name}" section.
AddKeyedAzureCosmosContainer(IHostApplicationBuilder, string, Action<MicrosoftAzureCosmosSettings>, Action<CosmosClientOptions>) Section titled AddKeyedAzureCosmosContainer(IHostApplicationBuilder, string, Action<MicrosoftAzureCosmosSettings>, Action<CosmosClientOptions>) extension
Registers the Cosmos.Container as a singleton for given name in the services provided by the builder.
public static class AspireMicrosoftAzureCosmosExtensions
{
public static void AddKeyedAzureCosmosContainer(
this IHostApplicationBuilder builder,
string name,
Action<MicrosoftAzureCosmosSettings>? configureSettings = null,
Action<CosmosClientOptions>? configureClientOptions = null)
{
// ...
}
}
builder IHostApplicationBuilder The Hosting.IHostApplicationBuilder to read config from and add services to.
name string The name of the component, which is used as the ServiceDescriptor.ServiceKey of the service and also to retrieve the connection string from the ConnectionStrings configuration section.
configureSettings Action<MicrosoftAzureCosmosSettings> optional An optional method that can be used for customizing the MicrosoftAzureCosmosSettings. It's invoked after the settings are read from the configuration.
configureClientOptions Action<CosmosClientOptions> optional An optional method that can be used for customizing the Cosmos.CosmosClientOptions.
InvalidOperationException If required ConnectionString is not provided in configuration section
Reads the configuration from "Aspire:Microsoft:Azure:Cosmos:{name}" section.
AddKeyedAzureCosmosDatabase(IHostApplicationBuilder, string, Action<MicrosoftAzureCosmosSettings>, Action<CosmosClientOptions>) Section titled AddKeyedAzureCosmosDatabase(IHostApplicationBuilder, string, Action<MicrosoftAzureCosmosSettings>, Action<CosmosClientOptions>) extension CosmosDatabaseBuilder
Registers the Cosmos.Database as a singleton for given name in the services provided by the builder and returns a CosmosDatabaseBuilder to support chaining multiple container registrations against the same database.
public static class AspireMicrosoftAzureCosmosExtensions
{
public static CosmosDatabaseBuilder AddKeyedAzureCosmosDatabase(
this IHostApplicationBuilder builder,
string name,
Action<MicrosoftAzureCosmosSettings>? configureSettings = null,
Action<CosmosClientOptions>? configureClientOptions = null)
{
// ...
}
}
builder IHostApplicationBuilder The Hosting.IHostApplicationBuilder to read config from and add services to.
name string The name of the component, which is used as the ServiceDescriptor.ServiceKey of the service and also to retrieve the connection string from the ConnectionStrings configuration section.
configureSettings Action<MicrosoftAzureCosmosSettings> optional An optional method that can be used for customizing the MicrosoftAzureCosmosSettings. It's invoked after the settings are read from the configuration.
configureClientOptions Action<CosmosClientOptions> optional An optional method that can be used for customizing the Cosmos.CosmosClientOptions.
InvalidOperationException If required ConnectionString is not provided in configuration section
Reads the configuration from "Aspire:Microsoft:Azure:Cosmos:{name}" section.