Using Get-DbaDatabase inside of commands? #9381
Replies: 2 comments
-
sorry, I need a "primer" to recall the "whole deal". Theoretically, yes, if some command hugely adverses the times needed to enumerate something, that command may avoid using Get-DbaDatabase. Point here, though, is .... what does Get-DbaDatabase "on top" on what SMO does that adds the "performance penalty" ? If, for some reason, Get-DbaDatabase is slow (it wasn't) then a "fix" on it kills two (or more) birds with a stone. |
Beta Was this translation helpful? Give feedback.
-
Thanks for the feedback. Is related to #9387. I changed New-DbaDbUser to use Get-DbaDatabase. |
Beta Was this translation helpful? Give feedback.
-
Before I re-refactor New-DbaDbUser I would like to make a decision: Do we want to use Get-DbaDatabase inside of our commands?
I think @wsmelton is correct here: https://github.com/dataplat/dbatools/pull/8827/files#r1150859704
We should avoid to use those heavy commands and just use Connect-DbaInstance to (re-)connect and the use the SMO itself.
If we (@potatoqualitee , @wsmelton , @niphlod ) agree on using SMO, I will open a PR to fix the command. Otherwise I don't know if I want to invest the time to refactor the command (again).
Here is the history of the command:
https://github.com/dataplat/dbatools/commits/development/public/New-DbaDbUser.ps1
Current bug that needs a fix: #9340 (more details in that issue)
Beta Was this translation helpful? Give feedback.
All reactions