On the surface this looks pretty easy. After a little digging I discovered that this command binding will add a "Show Table Data" menu option and bring up a nice OleDB-based data browser under VS 2005.
<CommandBinding name="Browse_Data" guid="501822E1-B5AF-11d0-B4DC-00A0C91506EF" cmdid="12384"
handler="Microsoft.VisualStudio.DataTools.DBPackage.VDT_OLEDB_CommandHandler_TableTools">
<Parameter value="Open"/>
</CommandBinding>
The problem, of course, is that this doesn't work under VS 2008. The handler under VS 2008 is implemented by an object with the guid of 884DD964-5327-461f-9F06-6484DD540F8F. My first approach was to define two of these bindings and no matter which version of VS ran one of them would fail (and not add any menu item) while the other would succeed. VS doesn't like that. Apparently the guid and cmdId together form a key and you get a key added twice error. Hmmm
My good buddy Stephen at Microsoft offered up the solution of overriding the GetDataViews method of DataViewSupport and tweaking the XML that is returned. It turns out that he was spot on. I set all the handlers in the XML file to be proper for VS 2005, changed my DataViewSupport derived class to now use the no parameter constructor base, and then overrode the GetDataViews method like so.
public override Stream GetDataViews() { string xmlName = "MySql.Data.VisualStudio.DDEX.MySqlDataViewSupport.xml"; Assembly executingAssembly = Assembly.GetExecutingAssembly(); Stream stream = executingAssembly.GetManifestResourceStream(xmlName); StreamReader reader = new StreamReader(stream); string xml = reader.ReadToEnd(); reader.Close(); // if we are running under VS 2008 then we need to switch out a couple // of command handlers DTE dte = Package.GetGlobalService(typeof(DTE)) as DTE; if (dte.Version.StartsWith("9")) xml = xml.Replace ("Microsoft.VisualStudio.DataTools.DBPackage.VDT_OLEDB_CommandHandler_TableTools", "884DD964-5327-461f-9F06-6484DD540F8F"); MemoryStream ms = new MemoryStream(xml.Length); StreamWriter writer = new StreamWriter(ms); writer.Write(xml); writer.Flush(); ms.Position = 0; return ms; }
I won't bother with showing you a pic of it working in MySQL because it looks just like the other pic. But, then again, that's the point. :)
I have found two interesting sources http://fileshunt.com and http://filesfinds.com and would like to give the benefit of my experience to you.
ReplyDeletethanks for sharing your ideas i really appreciate it!great post!
ReplyDeletenice post, thank you
ReplyDeleteGreat info! I have a blog with the same interest/topic. Hope we can exchange links.
ReplyDeleteBest Regards!
Ginj
thanks for info, great post
ReplyDeleteWoah, that's cool stuff, many thanks for you..
ReplyDeleteThis is a great collection of CSS-related links
ReplyDeletemy aboriginal move is like this, I access was to ascertain two of these bindings and no amount which adaptation of VS ran one of them would abort (and not add any card item) while the added would succeed. VS doesn't like that. Apparently the guid and cmdId calm anatomy a key and you get a key added alert error
ReplyDeleteWhat a nice post! Thank you for posting an informative article.
ReplyDeletethanks!
ReplyDeleteI digged this for more news from you.
ReplyDeleteRegards and respect
Worker
Super Website...
ReplyDelete[...] that is the end of this article. Here you’ll find some sites that we think you’ll appreciate, just click the links over[...]...