You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
/// Registers the <see cref="Database"/> as a singleton in the services provided by the <paramref name="builder"/>.
43
-
/// </summary>
44
-
/// <param name="builder">The <see cref="IHostApplicationBuilder" /> to read config from and add services to.</param>
45
-
/// <param name="connectionName">The connection name to use to find a connection string.</param>
46
-
/// <param name="configureSettings">An optional method that can be used for customizing the <see cref="MicrosoftAzureCosmosSettings"/>. It's invoked after the settings are read from the configuration.</param>
47
-
/// <param name="configureClientOptions">An optional method that can be used for customizing the <see cref="CosmosClientOptions"/>.</param>
48
-
/// <remarks>Reads the configuration from "Aspire:Microsoft:Azure:Cosmos" section.</remarks>
49
-
/// <exception cref="InvalidOperationException">If required ConnectionString is not provided in configuration section</exception>
/// Registers the <see cref="Container"/> as a singleton in the services provided by the <paramref name="builder"/>.
76
43
/// </summary>
@@ -79,6 +46,15 @@ public static void AddAzureCosmosDatabase(
79
46
/// <param name="configureSettings">An optional method that can be used for customizing the <see cref="MicrosoftAzureCosmosSettings"/>. It's invoked after the settings are read from the configuration.</param>
80
47
/// <param name="configureClientOptions">An optional method that can be used for customizing the <see cref="CosmosClientOptions"/>.</param>
81
48
/// <remarks>Reads the configuration from "Aspire:Microsoft:Azure:Cosmos" section.</remarks>
49
+
/// <remarks>
50
+
/// The <see cref="Container"/> is registered as a singleton in the services provided by
51
+
/// the <paramref name="builder"/> and does not reuse any existing <see cref="CosmosClient"/>
52
+
/// instances in the DI container. The connection string associated with the <paramref name="connectionName"/>
53
+
/// must contain the database name and container name or be set in the <paramref name="configureSettings" />
54
+
/// callback. To interact with multiple containers against the same database, use
55
+
/// <see cref="CosmosDatabaseBuilder"/> to register the database and then call
56
+
/// <see cref="CosmosDatabaseBuilder.AddKeyedContainer(string)"/> for each container.
57
+
/// </remarks>
82
58
/// <exception cref="InvalidOperationException">If required ConnectionString is not provided in configuration section</exception>
83
59
publicstaticvoidAddAzureCosmosContainer(
84
60
thisIHostApplicationBuilderbuilder,
@@ -94,12 +70,7 @@ public static void AddAzureCosmosContainer(
94
70
{
95
71
thrownewInvalidOperationException($"The connection string '{connectionName}' does not exist or is missing the container name or database name.");
@@ -132,72 +103,89 @@ public static void AddKeyedAzureCosmosClient(
132
103
}
133
104
134
105
/// <summary>
135
-
/// Registers the <see cref="Database"/> as a singleton for given <paramref name="name" /> in the services provided by the <paramref name="builder"/>.
106
+
/// Registers the <see cref="Container"/> as a singleton for given <paramref name="name" /> in the services provided by the <paramref name="builder"/>.
136
107
/// </summary>
137
108
/// <param name="builder">The <see cref="IHostApplicationBuilder" /> to read config from and add services to.</param>
138
109
/// <param name="name">The name of the component, which is used as the <see cref="ServiceDescriptor.ServiceKey"/> of the service and also to retrieve the connection string from the ConnectionStrings configuration section.</param>
139
110
/// <param name="configureSettings">An optional method that can be used for customizing the <see cref="MicrosoftAzureCosmosSettings"/>. It's invoked after the settings are read from the configuration.</param>
140
111
/// <param name="configureClientOptions">An optional method that can be used for customizing the <see cref="CosmosClientOptions"/>.</param>
141
112
/// <remarks>Reads the configuration from "Aspire:Microsoft:Azure:Cosmos:{name}" section.</remarks>
113
+
/// <remarks>
114
+
/// The <see cref="Container"/> is registered as a singleton in the services provided by
115
+
/// the <paramref name="builder"/> and does not reuse any existing <see cref="CosmosClient"/>
116
+
/// instances in the DI container. The connection string associated with the <paramref name="name"/>
117
+
/// must contain the database name and container name or be set in the <paramref name="configureSettings" />
118
+
/// callback. To interact with multiple containers against the same database, use
119
+
/// <see cref="CosmosDatabaseBuilder"/> to register the database and then call
120
+
/// <see cref="CosmosDatabaseBuilder.AddKeyedContainer(string)"/> for each container.
121
+
/// </remarks>
142
122
/// <exception cref="InvalidOperationException">If required ConnectionString is not provided in configuration section</exception>
/// Registers the <see cref="Container"/> as a singleton for given <paramref name="name" /> in the services provided by the <paramref name="builder"/>.
143
+
/// Registers the <see cref="Database"/> as a singleton the services provided by the <paramref name="builder"/>
144
+
/// and returns a <see cref="CosmosDatabaseBuilder"/> to support chaining multiple container registrations against the same database.
169
145
/// </summary>
170
146
/// <param name="builder">The <see cref="IHostApplicationBuilder" /> to read config from and add services to.</param>
171
-
/// <param name="name">The name of the component, which is used as the <see cref="ServiceDescriptor.ServiceKey"/> of the service and also to retrieve the connection string from the ConnectionStrings configuration section.</param>
147
+
/// <param name="connectionName">The connection name to use to find a connection string.</param>
172
148
/// <param name="configureSettings">An optional method that can be used for customizing the <see cref="MicrosoftAzureCosmosSettings"/>. It's invoked after the settings are read from the configuration.</param>
173
149
/// <param name="configureClientOptions">An optional method that can be used for customizing the <see cref="CosmosClientOptions"/>.</param>
174
150
/// <remarks>Reads the configuration from "Aspire:Microsoft:Azure:Cosmos:{name}" section.</remarks>
175
151
/// <exception cref="InvalidOperationException">If required ConnectionString is not provided in configuration section</exception>
/// Registers the <see cref="Database"/> as a singleton for given <paramref name="name" /> in the services provided by the <paramref name="builder"/>
167
+
/// and returns a <see cref="CosmosDatabaseBuilder"/> to support chaining multiple container registrations against the same database.
168
+
/// </summary>
169
+
/// <param name="builder">The <see cref="IHostApplicationBuilder" /> to read config from and add services to.</param>
170
+
/// <param name="name">The name of the component, which is used as the <see cref="ServiceDescriptor.ServiceKey"/> of the service and also to retrieve the connection string from the ConnectionStrings configuration section.</param>
171
+
/// <param name="configureSettings">An optional method that can be used for customizing the <see cref="MicrosoftAzureCosmosSettings"/>. It's invoked after the settings are read from the configuration.</param>
172
+
/// <param name="configureClientOptions">An optional method that can be used for customizing the <see cref="CosmosClientOptions"/>.</param>
173
+
/// <remarks>Reads the configuration from "Aspire:Microsoft:Azure:Cosmos:{name}" section.</remarks>
174
+
/// <exception cref="InvalidOperationException">If required ConnectionString is not provided in configuration section</exception>
0 commit comments