We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date

Node.Name and Connector.Name cannot be int number

Hi,
I'm trying tu put database Id's into Name properties of Connector and Node in my diagram, but when I do this, diagram will not render. Reason why I want to do this is that it is easier for me to track changes in diagram and then save them into my database model. Good thing is, that when I change connector's SourceNode and/or TargedNode I will automatically have correct database id's of connected nodes in those properties. I do not want to use text names as they do not have to be unique (user can have two nodes with same name). Of course I can use textual unique identificator such as Guid for this, but I think it will be much easier and cleaner if I put database Id into Name properties of Connectors and Nodes.

What do you think? Any ideas?

1 Reply

SG Shyam G Syncfusion Team October 7, 2016 07:31 AM UTC

Hi Tom, 

You can use models dataSourceSettings Id property and models dataSourceSettings connectionDataSource Id property which map the database column values into the node’s name and connectors name property respectively. Please refer to the code example and sample below. 

Code example: 

  model.DataSourceSettings = new DataSourceSettings() 
            { 
                DataSource = DiagramContext.NodeDetails.ToList(), 
                Id = "Name", 
                 
                ConnectionDataSource = new ConnectionDataSourceSettings() 
                { 
                    DataSource = DiagramContext.ConnectorDetails.ToList(), 
                    Id = "Name", 
                } 
            }; 


Regards, 
Shyam G 


Loader.
Live Chat Icon For mobile
Up arrow icon