diff --git a/src/Marten/Storage/WildcardSingleServerMultiTenancy.cs b/src/Marten/Storage/WildcardSingleServerMultiTenancy.cs index 5e08150b11..d2f05aff33 100644 --- a/src/Marten/Storage/WildcardSingleServerMultiTenancy.cs +++ b/src/Marten/Storage/WildcardSingleServerMultiTenancy.cs @@ -1,8 +1,8 @@ -using System; using System.Collections.Generic; using System.Threading.Tasks; using JasperFx.Core; using Marten.Schema; +using Npgsql; using Weasel.Core.Migrations; namespace Marten.Storage; @@ -23,11 +23,11 @@ string prefix options.Policies.AllDocumentsAreMultiTenanted(); _database = new MartenDatabase( options, - new ConnectionFactory(connectionString), + NpgsqlDataSource.Create(connectionString), identifier ); _prefix = prefix; - Cleaner = new CompositeDocumentCleaner(this); + Cleaner = new CompositeDocumentCleaner(this, options); } public ValueTask> BuildDatabases() @@ -76,4 +76,9 @@ string tenantId var tenant = GetTenant(tenantId); return ReferenceEquals(database, tenant.Database); } + + public void Dispose() + { + _database.Dispose(); + } }