dataplat / dbatools

🚀 SQL Server automation and instance migrations have never been safer, faster or freer
https://dbatools.io
MIT License
2.39k stars 787 forks source link

Connect-DbaInstance: Only use GetDatabaseConnection if needed #9402

Closed andreasjordan closed 1 week ago

andreasjordan commented 1 week ago

Type of Change

Purpose

Approach

Commands to test

Screenshots

Learning

Currently only to see if tests fail...

andreasjordan commented 1 week ago

OK, I have to do more tests. Will do this in the next days...

andreasjordan commented 1 week ago

Turns out: It is needed always after .ConnectionContext.Copy() as a new connection is made and thus the database context is reset to master.