DGML testing

Topics: serialization
Mar 23, 2010 at 3:36 PM

I have downloaded the latest source.

I run this code:

DataSet ds = _repository.GetSchemaDataSet(_tableNames);
var g = ds.ToGraph();           
g.ToDirectedGraphML().WriteXml("test.xml");

My question (I will blog about this, I promise!):

How do I get Label tags in the generated dgml? (Or are we just not there yet)...

Thanks for a wonderful library.

Coordinator
Mar 23, 2010 at 4:08 PM

There are different 'ToDirectedGraphML' overloads that allow to pass a delegate that can modify the Node element. From there, you can set the Label property.

Mar 24, 2010 at 7:19 PM

Thanks, it got this to work - will complete my dataset population and then do some blogging.

        internal void GenerateSchemaGraph()
        {
            var formatNode = new Action<DataTable, DirectedGraphNode>(Generator.FormatNode);
            var formatLink = new Action<DataRelationEdge, DirectedGraphLink>(Generator.FormatLink);

            DataSet ds = _repository.GetSchemaDataSet(_tableNames);
            
            var g = ds.ToGraph();
            g.ToDirectedGraphML(AlgorithmExtensions.GetVertexIdentity(g), AlgorithmExtensions.GetEdgeIdentity(g), formatNode, formatLink).WriteXml("test.xml");
        }

<font size="2">

 

</font>

 

Coordinator
Mar 25, 2010 at 12:30 AM

If you write to a test.dgml file, you can simply double-click on it and it will open in VS2010 magically.