Skip to content

Commit a27d6ca

Browse files
I'm attempting to use the library in a Multi Tenant scenario where each tenant connects to their own specific Cosmos DB (#428)
Along with the previous change I did to make ICosmosClientProvider public (#398) * made ICosmosContainerProvider public The Default implementation caches containers, I needed a custom implementation to cache these per Tenant * Repository option - I made DatanaseId, ContainerId and connection string virtual Again in my implementation I need these to be tenant specific, making these virtual allows me over replace this with a MultiTenant version on RepositoryOptions
1 parent 6e2204e commit a27d6ca

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

src/Microsoft.Azure.CosmosRepository/Options/RepositoryOptions.cs

+3-3
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ public class RepositoryOptions
2222
/// <summary>
2323
/// Gets or sets the cosmos connection string. Primary or secondary connection strings are valid.
2424
/// </summary>
25-
public string? CosmosConnectionString { get; set; }
25+
public virtual string? CosmosConnectionString { get; set; }
2626

2727
/// <summary>
2828
/// Gets or sets the cosmos account endpoint URI. This can be retrieved from the Overview section of the Azure Portal.
@@ -39,15 +39,15 @@ public class RepositoryOptions
3939
/// <remarks>
4040
/// Defaults to "database", unless otherwise specified.
4141
/// </remarks>
42-
public string DatabaseId { get; set; } = "database";
42+
public virtual string DatabaseId { get; set; } = "database";
4343

4444
/// <summary>
4545
/// Gets or sets the name identifier for the cosmos container that corresponds to the <see cref="DatabaseId"/>.
4646
/// </summary>
4747
/// <remarks>
4848
/// Defaults to "container", unless otherwise specified.
4949
/// </remarks>
50-
public string ContainerId { get; set; } = "container";
50+
public virtual string ContainerId { get; set; } = "container";
5151

5252
/// <summary>
5353
/// Gets or sets whether to optimize bandwidth.

src/Microsoft.Azure.CosmosRepository/Providers/ICosmosContainerProvider.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ namespace Microsoft.Azure.CosmosRepository.Providers;
77
/// The cosmos container provider exposes a means of providing
88
/// an instance to the configured <see cref="Container"/> object.
99
/// </summary>
10-
interface ICosmosContainerProvider<TItem> where TItem : IItem
10+
public interface ICosmosContainerProvider<TItem> where TItem : IItem
1111
{
1212
/// <summary>
1313
/// Asynchronously gets the configured <see cref="Container"/> instance that corresponds to the

0 commit comments

Comments
 (0)