I have a VSIP package loaded into SSMS. I want to be notified when the connection on the current window changes.
I have managed to get *part* of the current window's connection with the following code:
Microsoft.SqlServer.Management.UI.VSIntegration.Editors.
IScriptFactory scriptFactory = ServiceCache.ScriptFactory;
CurrentlyActiveWndConnectionInfo connInfo = scriptFactory.CurrentlyActiveWndConnectionInfo;
but that connection info object does not have the database name in it! I found the ISqlScriptWindowWithConnection interface (in Microsoft.SqlServer.Management.UI.VSIntegration.Editors), and it contains an event named NewConnectionForScript... sounds just like what I need, eh? But I can't get an instance of that interface anywhere!!!! I've tried seemingly a million different routes.
So the question is, does anyone know how I can get an object that implements the ISqlScriptWindowWithConnection interface for the current document? Or any other way that I can get the connection info associated with the current document window?
~Steve