StoreViewer - a hidden gem

Well, maybe not exactly hidden, but certainly not well-known.

Tucked away in the Microsoft.VisualStudio.Modeling.sdk assembly in the Microsoft.VisualStudio.Modeling.Diagnostics namespace you'll find a little class called StoreViewer that can visualize for you the full contents of your Store - both the model elements and the domain metadata.

Here it is showing the contents of an ExampleElement MEL from the MinimalLanguage template:

Note the pane on the bottom right where you can see all of the link instances that the element is playing a role in.  This is really useful where you've got links that aren't visualized anywhere in your designer.

To call this dialog up, you just need to use the overrloaded static Show() method:

        public static void Show(Store store);
 
        public static void Show(Partition partition);
 
        public static void Show(ModelElement element);

As you can see, you can focus on just a single model element or a whole store or partition.  Its usually most useful to look at a whole store as then you can browse around between elements.

Here's the browser examining the domain metadata in the store:

You can see the metadata for the domain class ExampleElement and see the set of rules that have been added to fire against it.

One way of using this is to hook it up to a menu entry in a debug build of your designer, but perhaps its most valuable use is in the Visual Studio immediate window.  When you hit a breakpoint in your designer, simply type the following into the immediate window:

Microsoft.VisualStudio.Modeling.Diagnostics.StoreViewer.Show(<myModelElement>.Store);

Kudos to DmitriV for implementing this very slick piece of functionality.

Published 15 February 07 07:45 by GarethJ
Filed under: ,

Comments

No Comments
New Comments to this post are disabled

Search

This Blog

Disclaimer
The information in this weblog is provided "AS IS" with no warranties, and confers no rights. This weblog does not represent the thoughts, intentions, plans or strategies of my employer. It is solely my opinion. Inappropriate comments will be deleted at the authors discretion.
All code samples are provided "AS IS" without warranty of any kind, either express or implied, including but not limited to the implied warranties of merchantability and/or fitness for a particular purpose.

Tags

Archives

Architects who Model

DSL Tools Team

Links

Syndication

Page view tracker