Almost one year ago I wrote an article on my web site about how to show the Choose Data Source dialog of Visual Studio from you own code (an add-in, for example). It happens that the approach that I showed works only with the .NET data providers supplied with the .NET Framework (namely SQL Server, Oracle, ODBC and OLEDB), but not with 3rd party providers such as ODP.NET for Oracle, etc. In fact I knew that when I wrote the article but it was not until yesterday when I had to revisit it to use it. I spent several hours struggling with the Visual Studio implementation (which shows 3rd party .NET data providers) and finally I figured it out, so I have updated the article:
HOWTO: Using the Choose Data Source dialog of Visual Studio 2005 from your own code
As you can see, it’s actually quite simple when you know how to do it, but if you have to investigate, the Visual Studio internal implementation is so complex as a DataProvider class that inherits from another class named DataProvider (yep, same name but from another assembly), which implements IVSDataProvider and if that is not enough you have another VSDataProvider class. And this mess repeats with another classes such as DataConnectionDialog, etc. I wonder if this is the kind of things that make VS so slow… All this is caused because VS extends an independent implementation of the Choose Data Source dialog to inject VS-only registered DDEX providers (a DDEX is a design-time extension for an ADO.NET 2.0 provider). It would be much better to register the DDEX providers outside the Visual Studio registry key and make the Microsoft.Data.*.dll assemblies recognize 3rd party DDEX providers for the Choose Data Source dialog.
BTW, when you want to reference a Visual Studio assembly in the installation folder, MVP fellow Daniel Cazzulino has a great post about doing it without hardcoding its path. It would be great if VS did it automatically, but when he reported back to Microsoft, the engineer could not reproduce it. Too bad, because it is quite easy to reproduce the problem…you can vote for it in the link provided in that post.
Anyway, I think that the updated article solves completely the Choose Data Source dialog problem. Although DDEX came late to Visual Studio (it was not until 2005) we are seeing more and more 3rd party DDEX providers truly integrating inside Visual Studio, that is, using the Visual Studio Server Explorer instead its own explorer toolwindow (such as the Oracle Explorer of ODP.NET 10.x), and using the standard Choose Data Source dialog, etc. This is great news for Visual Studio!