Skip to content

Commit

Permalink
Permit database implementations to override the base's connection source
Browse files Browse the repository at this point in the history
  • Loading branch information
Hawxy authored and jeremydmiller committed Nov 19, 2024
1 parent a836da3 commit aca2261
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
7 changes: 1 addition & 6 deletions src/Weasel.Core/Migrations/DatabaseBase.cs
Original file line number Diff line number Diff line change
Expand Up @@ -58,11 +58,6 @@ private static TConnection CreateConnection(string connectionString)
public string Identifier { get; }


TConnection IConnectionSource<TConnection>.CreateConnection()
{
return _connectionSource();
}

/// <summary>
/// All referenced schema names by the known objects in this database
/// </summary>
Expand Down Expand Up @@ -235,7 +230,7 @@ public async Task AssertDatabaseMatchesConfigurationAsync(CancellationToken ct =
}
}

public TConnection CreateConnection()
public virtual TConnection CreateConnection()
{
return _connectionSource();
}
Expand Down
5 changes: 5 additions & 0 deletions src/Weasel.Postgresql/PostgresqlDatabase.cs
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,11 @@ public NpgsqlConnection CreateConnection(TargetSessionAttributes targetSessionAt
return base.CreateConnection();
}

public override NpgsqlConnection CreateConnection()
{
return CreateConnection();
}

public ValueTask DisposeAsync()
{
return DataSource.DisposeAsync();
Expand Down

0 comments on commit aca2261

Please sign in to comment.