You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
SMO objects can't be scripted when IsDesignMode == true #27
Over the years, "design mode" has been neglected such that SMO requires a live connection to a server in order to construct an object hierarchy and generate scripts for it.
EG this throws an exception during Script():
// setting ServerVersion allows setting Database.Parent without a server query to get the version// set TrueName to ensure the URN that identifies the Server is completevarserverConnection=newServerConnection(){ServerVersion=newServerVersion(15,0),TrueName="designMode"};varserver=newManagement.Smo.Server(serverConnection);// designmode requires an offline connection(serverasISfcHasConnection).ConnectionContext.Mode=SfcConnectionContextMode.Offline;vardatabase=newDatabase(){Parent=server,Name="dbname"};varscript=database.Script();
Activity
shueybubbles commentedon Jan 10, 2022
Fixed, at least for this narrow scenario
Merged PR 422743: SMO: fix design mode and add code coverage