Skip to content

Commit

Permalink
fix: get NpgsqlDataSource from keyed services (#131)
Browse files Browse the repository at this point in the history
  • Loading branch information
elmaxe authored Aug 30, 2024
1 parent 5632f5b commit 5032c53
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
<PackageIconUrl>https://raw.githubusercontent.com/BookBeat/knightbus/master/documentation/media/images/knighbus-64.png</PackageIconUrl>
<PackageIcon>knighbus-64.png</PackageIcon>
<RepositoryUrl>https://github.com/BookBeat/knightbus</RepositoryUrl>
<Version>1.3.1</Version>
<Version>1.3.2</Version>
<PackageTags>knightbus;postgresql;queues;messaging</PackageTags>
<LangVersion>latest</LangVersion>
<ImplicitUsings>enable</ImplicitUsings>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
using System.Runtime.CompilerServices;
using KnightBus.Messages;
using Microsoft.Extensions.DependencyInjection;
using Npgsql;
using NpgsqlTypes;
using static KnightBus.PostgreSql.PostgresConstants;
Expand All @@ -11,7 +12,7 @@ public class PostgresManagementClient
private readonly NpgsqlDataSource _npgsqlDataSource;
private readonly IMessageSerializer _serializer;

public PostgresManagementClient(NpgsqlDataSource npgsqlDataSource, IPostgresConfiguration configuration)
public PostgresManagementClient([FromKeyedServices(NpgsqlDataSourceContainerKey)] NpgsqlDataSource npgsqlDataSource, IPostgresConfiguration configuration)
{
_npgsqlDataSource = npgsqlDataSource;
_serializer = configuration.MessageSerializer;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,6 @@ public static class PostgresConstants
public const string SubscriptionPrefix = "s";
public const string DlQueuePrefix = "dlq";
public const string SchemaName = "knightbus";
internal const string NpgsqlDataSourceContainerKey = "knightbus-postgres";

public const string NpgsqlDataSourceContainerKey = "knightbus-postgres";
}

0 comments on commit 5032c53

Please sign in to comment.