Mohammed Atef’s Technical blog

Directed Graph Markup Language(DGML)

 Introduction

DGML (Directed Graph Markup Language) is Microsoft use in VSTS 2010 Architecture to render graphs the power of DGML is in its simplicity.

Using DGML Code
if you have Visual Studio 2010 CTP you can add new file and rename it with dgml extension then add the following lines of code

<DirectedGraph xmlns=http://schemas.microsoft.com/vs/2009/dgml>
  <Nodes>      </Nodes>
  <Links>      </Links>
</DirectedGraph>

The DirectedGraph node used to inform Visual studio that we have DGML file. Nodes list contain all nodes for this diagram and Links determine the link between Nodes.

Yes it is very simple, let’s see what happen if you need to add to nodes like the below Image

 

Directed Graph Markup Language

Directed Graph Markup Language

 Just write the following code

<DirectedGraph xmlns=http://schemas.microsoft.com/vs/2009/dgml>
  <Nodes>      </Nodes>
  <Links>    <Link Source=From Target=To />  </Links>
</DirectedGraph>

 You can notice that we just add one line which tells the Visual Studio that we have Source node From and Target Node is To.
I think you get it now, you can add any number of related nodes with this simple code

Containers

What happen if you need to group number of nodes into one single node? It is very simple you can create Container which can group number of nodes.
You can create container with adding two few lines of code as follows

<Node Id=My containner Group=Expanded/>
<
Link Source=My containner Target=From Category=Contains/>

So if you need to draw diagram like the below one

 

Directed Graph Markup Language

Directed Graph Markup Language

Just write this few lines of code

<DirectedGraph xmlns=http://schemas.microsoft.com/vs/2009/dgml>
  <Nodes>    <Node Id=My containner Group=Expanded/>  </Nodes>
  <Links>
    <Link Source=From Target=To />
    <Link Source=My containner Target=From Category=Contains/>
  </Links>
</DirectedGraph>

Actually VSTS 2010 CTP use DGML for draw all architecture for assemblies, namespace, classes and method.
It is very useful for any developer to understand the architecture for old exist systems, now you can do this by click View->Architecture
Explorer from Visual Studio IDE as shown below

 

VS 2010 CTP Architecture Explorer

VS 2010 CTP Architecture Explorer

 Conclusion

 Really thank you Microsoft for this great product. I think Microsoft has been covered a lot of our needs in our Software Lifecycle.Hope this help….

Advertisements

March 30, 2009 - Posted by | .Net 2010 | , ,

No comments yet.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: