ÇáãÓÇÚÏ ÇáÔÎÕí ÇáÑÞãí

ãÔÇåÏÉ ÇáäÓÎÉ ßÇãáÉ : Directed Graph Markup Languag.e(DGML)



BarakaSoft
04-12-2009, 02:22 AM
Introduction DGML (Directed Graph Markup ********) 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

http://mohammedatef.files.wordpress.com/2009/03/dgml1.jpg?w=248&h=97 (http://mohammedatef.files.wordpress.com/2009/03/dgml1.jpg)Directed Graph Markup ********

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

http://mohammedatef.files.wordpress.com/2009/03/dgml2.jpg?w=300&h=101 (http://mohammedatef.files.wordpress.com/2009/03/dgml2.jpg)Directed Graph Markup ********


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 (http://blogs.msdn.com/briankel/archive/2008/10/27/helpful-links-for-the-visual-studio-2010-ctp.aspx) 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

http://mohammedatef.files.wordpress.com/2009/03/architecture.jpg?w=300&h=102 (http://mohammedatef.files.wordpress.com/2009/03/architecture.jpg)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….