Skip to content

Commit

Permalink
Fix ContainerId parameter
Browse files Browse the repository at this point in the history
  • Loading branch information
cdorst committed Jan 30, 2024
1 parent f162add commit d4b90a9
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<PackageVersion>1.0.1</PackageVersion>
<PackageVersion>2.0.0</PackageVersion>
<Description>Service types for interacting with CosmosDb</Description>
<TargetFramework>net8.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
Expand Down
4 changes: 2 additions & 2 deletions BibleTalkAI.CosmosDatabase.Services/CosmosDbService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,11 @@
namespace BibleTalkAI.CosmosDatabase.Services;

public class CosmosDbService<TDocument>
(CosmosClient db, string databaseName, CosmosContainer container)
(CosmosClient db, string databaseName, CosmosContainer container, string containerId)
: IDbService<TDocument>
where TDocument : struct
{
private readonly Container _container = db.GetContainer(databaseName, container.ToString());
private readonly Container _container = db.GetContainer(databaseName, containerId);
private readonly CosmosSerializer _serializer = db.ClientOptions.Serializer;

public CosmosContainer CosmosContainer => container;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,10 +38,10 @@ public static CosmosClient AddDatabaseServices(
return cosmosClient;
}

public static IServiceCollection AddCosmosDbService<TDocument>(this IServiceCollection services, CosmosClient cosmosClient, string databaseName, CosmosContainer container)
public static IServiceCollection AddCosmosDbService<TDocument>(this IServiceCollection services, CosmosClient cosmosClient, string databaseName, CosmosContainer container, string containerId)
where TDocument : struct
{
var cosmosService = new CosmosDbService<TDocument>(cosmosClient, databaseName, container);
var cosmosService = new CosmosDbService<TDocument>(cosmosClient, databaseName, container, containerId);
services.AddSingleton<IDbService<TDocument>>(cosmosService);

return services;
Expand Down

0 comments on commit d4b90a9

Please sign in to comment.