Sunday, May 4, 2014

A few words about simplicity: Using Red-Gate Ecosystem framework

In my first blog post I briefly covered when and why I created SQL Code Guard (SCG).
To be honest, the first version of SCG was a standalone application, but supporting a GUI took too much time so I decided to convert it to an SSMS plugin – in this case I was able to use SSMS’s GUI, its editors, syntax highlighting and so on.

After  some considerable research I discovered that the knowledge on how to write an SSMS addin is a much hidden treasure.


I found a few blog posts, some forum threads, and almost no official documentation!
There was a single blog post – and almost all other info sources referred to this one – but unfortunately it is no longer available (so we lost the first and last source of information)
Thankfully, later (much later) I encountered a few SSMS addin projects on Codeplex (a really nice portal). In hindsight I should have started researching on Codeplex from the outset – but this is another story.

Anyway, I began writing my SSMS addin.

At first it was built for SSMS 2005, as SQL Server 2005 was the primary database I was using at the time.
It was not so easy to write the addin without any readable documentation, but  against all odds, I managed it.
Yes, there were few unfortunate peculiarities, for example, leaving menu items around after uninstall, and so on – but at least it was working.

Later I turned to SQL 2008R2 (don’t ask me why I skipped 2008 – everybody did!), so I was forced to integrate SCG with SSMS 2008R2 – and new problems arose.  Different SSMS editions required different versions of system assemblies. I wasn’t a strong .Net developer (and still only just about good enough! (R)) so I was faced with many problems – but once more i prevailed.

Later SSMS 2012 emerged on the scene accompanied with totally new integration challenges. And don’t get me started on SSMS 2014!

It turns out that I was not the only guy who was frustrated with problems when writing SSMS addins.
A smart guy from Red Gate, David Pond, has developed the Red Gate SSMS Ecosystem, a framework that has made creation of SSMS addins as simple as A-B-C! It’s close to magical!

Yes, this framework has room to be further extended, expanded, polished, and documented,but right now it can save TONS of time during addin development.

It took about two weeks to integrate SCG to SSMS using the standard integration libraries,  and just two hours to totally rewrite the integration using the Red Gate SSMS Ecosystem framework. – This included downloading the framework, inspecting the sample code, making two cups of tea, examining the sample code again, rewriting the plugin,  - and subsequently throwing out a bunch of old-fashioned proxy assemblies that were used to integrate SCG with different versions of SSMS.  These were now no longer needed! – And finally committing the changes to SVN (yes, I’m  an MS certified  specialist  - and I’m using  SVN, not TFS  :) )
I will not detail how exactly I implemented the Red Gate SSMS Ecosystem framework – this isn't  necessary because the process itself is pretty simple and now  documented with examples. The one take-home message is that you should BE AWARE of the Red Gate SSMS Ecosystem. And now – you are, young Padawan.

May the Force be with you! ;)

SQL Code Guard is a free tool for SSMS developers and DBAs. Visit home site to download.

No comments:

Post a Comment