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

Database designer?

Hi,
Is it possible to use SyncFusion.Diagram for showing structure of the database tables and links between them?
The table structure would be obtained on runtime and diagram would be created on the fly?

If so, could you give some appropriate example?

Thanks in advance

39 Replies

J. J.Nagarajan Syncfusion Team February 16, 2007 07:12 PM UTC

Hi Ok,

Yes, it is possible to show the structure of database tables and links using Essential Diagram. I have attached the sample for your reference. In this sample you can drag and drop the data table symbols from the palette. Click Links->OrthogonalLink to activate the Orthogonal link and you can connect the symbol by using this link.

Please refer to it and let me know if you have any questions.

Thanks for using Syncfusion product.

Regards,
Nagaraj

CustomSymbols.zip


FR Felice Russo May 29, 2009 01:03 PM UTC

Hi,
I'll need to use Your Digram Tool for drawing database tables.
Is it possible to draw tables, fields, indexes, relations, ecc... as is it possible in Visio?
I have tried to download Your example but it gives me an error. Can You upload a new file with some sample?
Thank You very much.
Felice


GM Gowri Manohari D Syncfusion Team June 1, 2009 10:11 AM UTC

Hi Felice,

Here i have mentioned the link for the sample for Database Diagram.Visio diagram also supports database tables,relations,entities etc.Here i have mentioned the sample Visio database diagram.Please make use of it.


http://www.syncfusion.com:91/Support/user/uploads/CustomSymbols_8919d152.zip

http://files.syncfusion.com/support/Diagram.Windows/Forums/Database.zip


Thanks & Regards,
Gowri



FR Felice Russo June 5, 2009 08:33 PM UTC

Hi Gowri,

I have tried Your sample code with the last trial version of Syncfusion (7.2.0.20)...and Visual Studio 2005, but I get some errors.

1)
this.diagram1.Controller.MaxHistory = 256;

D:\Downloads\Tools\Syncfusion\CustomSymbols_8919d152\CustomSymbols\Form1.cs(191,29): error CS0117: 'Syncfusion.Windows.Forms.Diagram.DiagramController' does not contain a definition for 'MaxHistory'

2)

this.diagram1.Model.ShadowStyle.AlphaFactor = 128;

D:\Downloads\Tools\Syncfusion\CustomSymbols_8919d152\CustomSymbols\Form1.cs(205,36): error CS0117: 'Syncfusion.Windows.Forms.Diagram.ShadowStyle' does not contain a definition for 'AlphaFactor'

I have tried to remark this code lines but I get an exception on:

3)

((System.ComponentModel.ISupportInitialize)(this.diagram1.Model)).BeginInit();

Object reference not set to an instance of an object.

Can You help me?
Is there an upgraded code sample?

Thank You very much.
Felice


GM Gowri Manohari D Syncfusion Team June 10, 2009 11:45 AM UTC

Hi Felice,

Sorry for the inconvenience caused. I have created another sample for your requirement.

The sample provided meets the requirement by means of placing an UserControl inside a control node. The UserControl has a System Label and TreeView control in it.

Please refer the word document given in the attachment

Please download the sample from the below link,

http://files.syncfusion.com/support/Diagram.Windows/Forums/F56465/main.htm

Regards,
Gowri


FR Felice Russo June 21, 2009 02:11 PM UTC

Hi Gowri,

Your sample code now is ok.

I'd need to draw a database diagram with 1000 tables. Using the tree for each table I thing is expensive in memory.
I'd like to abtain a graphical table representation like Visio (a column for key type, a column with fields and a column with datatype).
Can You help me to draw correctly the table (visio-like) object considering the 1000 tables to design?

Thanks
Felice


GM Gowri Manohari D Syncfusion Team June 22, 2009 12:17 PM UTC

Hi Felice,

I have created sample for your requirement.

The sample which we have provided to you meets the requirement by means of node grouping,add labels to the child node and connect the ports inside the Group node.

Please download the sample from the below link,

http://files.syncfusion.com/support/Diagram.Windows/Forums/F56465_new/main.htm


Regards,
Gowri


FR Felice Russo June 29, 2009 02:42 PM UTC

Hi Gowri,

Great!
Just what I need!

I'm trying your suggest and I have another question.

I create the table with field, field type, ecc. Each field can have different length.
Suppose this:

Table1 |->38 chars
PK ThisIsPrimaryKeyField Integer |
ThisIsShortField String |

Table2 |->15 chars
PK Cod Integer |
Des String |

The two tables have different width.
How can I size this tables, while creating, differently on their content?

Regards,
Felice


GM Gowri Manohari D Syncfusion Team July 6, 2009 07:40 AM UTC

Hi Felice,

We can get the size of the TextNode by using TextNode.Size property. It will return the width and height of the textnode. Here I have mentioned sample code for TextNode with text (which you are given in the post).

/* code snippet */

Syncfusion.Windows.Forms.Diagram.TextNode t = new TextNode ("MyTablePK Cod: integer fsf sff fDes: integer");
t.SizeToText(SizeF.Empty);
diagram1.Model.AppendChild(t);

/* Ends */

In the above lines of code there is a property called SizeToText, it will fit the textnode into text size.We can get the size of the textnode (t) by t.Size property.

Let me know the above solution meets your requirement.

Regards,
Gowri



FR Felice Russo July 19, 2009 04:27 PM UTC

Hi Gowri,

Your suggest is Ok!
Tables now are sized correctly.

The attachment show an image of my DbViewer.
It has many relations between tables.
I'm using LineConnector but it's not right.
I have tried OrthogonalConnector but lines are drawn on tables...
I would like to obtain with a TableLayoutManager, tables with relations and with lines not crossing tables and all visible (like Visio).

Is there a Connector for my need?
The TableLayoutManager is right?

Regards,
Felice




DbViewer_6fe98957.JPG


FR Felice Russo July 19, 2009 04:35 PM UTC

Hi Gowri,

Just another question.

I need to read diagram node (each node is a Group) for getting location an size.
I need to store these data on a custom file for reading the next time I load the diagram.

I would like to save and load only location and size of nodes.
Can You give my any suggest for doing it?

Regards,
Felice


GM Gowri Manohari D Syncfusion Team July 20, 2009 10:57 AM UTC

Hi Felice,

For your first requirement, You can use TableLayoutManager for your requirement. Before layouting the nodes we should enable LineRouting and LineBridging property of the diagram in order to avoid the crossing the line over the node.

The properties are,

this.diagram1.Model.LineRoutingEnabled = true;
this.diagram1.Model.LineBridgingEnabled = true;


For your second requirement we don't have any direct method to save the location and size of the node. You can use the LoadSoap() and SaveSoap() method, in order to save the diagram into XML format. The XML file may be helpful for your requirement


Regards,
Gowri




FR Felice Russo July 25, 2009 08:24 PM UTC

Hi Gowri,

Ok, for Your suggest.

I have enabled Routing but when I have a lof of tables (60 group of textnodes) it's too slowly.
Do you have any suggest about?

I enabled orthogonal connector with decorator.
When I move the rectangle in the design area the decorator isnt drawn.
With the line connector, decorator drawing works fine!
See the attachment. In (A) it's right. in (B) it's no right. In (C) and (D) with line connector drawing is right.
Any suggest?

Regards,
Felice.



Connector_84109521.JPG


GM Gowri Manohari D Syncfusion Team July 27, 2009 07:17 AM UTC

Hi Felice,

You can Generate the nodes within the below diagram methods, it will increase the performance time.

diagram1.BeginUpdate();
// Node Generation Code
diagram1.EndUpdate();

For your second requirement i have mentioned link for the sample. The sample which i have used will create Orthogonal Connector with Decorator. Please make use of it.

http://files.syncfusion.com/support/Diagram.Windows/Incidents/I55409/main.htm

Regards,
Gowri



FE FeliceR July 27, 2009 09:26 PM UTC

Hi Gowry,

I tryed Your sample.
It's good when the two object aren't aligned (see attachment). Elsewhere the decorator isn't drawn.
Help me...

About routing and slow rendering, I'm using BeginUpdate() and EndUpdate() on startup (first draw).
The trouble is when I move an object. The diagram redraw everything and this slow down application.
Any suggest?

Is there a way to lock connector?
I need to draw connector but they must not be disconnected by user action. I need the user select connector for info on relation, so I cannot disable selection.

Regards,
Felice



connectorHorz_7222d6fe.JPG


GM Gowri Manohari D Syncfusion Team July 28, 2009 08:46 AM UTC

Hi Felice,

For your first point, it is a known issue in Connector. We have already logged defect report for that.

For your second point, while generating the node some events will be fire internally. So you should stop those events, it will automatically increase the performance.

diagram1.Model.BeginUpdate();
diagram1.Model.HistoryManager.Pause();
// Node Genaration Code
diagram1.Model.HistoryManager.Resume();
diagram1.Model.EndUpdate();

For your third requirement, diagram supports Node.EditStyle property in order to make diagram read only. The property which i have mentioned here will not allow to move the connector at any direction.

connector.EditStyle.AllowMoveX = false;
connector.EditStyle.AllowMoveY = false;

Regards,
Gowri


FR Felice Russo July 30, 2009 08:47 AM UTC

Hi Gowri,

ok, for disabling history manager, but must I disable it on dragging?
The diagram and line routing slow down during drag of textnodes (not during load operation).
I need to detect dragging and disabling history manager?

About EditStyle, ok for disabling moving, but I need to disable dragging of ports, because this disconnect my connector.

I can't set
EditStyle.AllowSelect = false
or
EditStyle.Enabled = false
because I need to select it for display properties info.

Any suggest?

Regards,
Felice


GM Gowri Manohari D Syncfusion Team July 30, 2009 10:31 AM UTC

Hi Felice,

The below code snippet solves your first requirement.

diagram1.Model.EventSink.PinPointChanged+=new PinPointChangedEventHandler(EventSink_PinPointChanged);

private void EventSink_PinPointChanged
(PinPointChangedEventArgs e)
{
diagram1.Model.HistoryManager.Pause();
diagram1.Invalidate(); // It will repaint the region object
diagram1.Refresh(); // It will refresh whole diagram
diagram1.Model.HistoryManager.Resume();
}
You can use either of the above two methods diagram1.Invalidate() or diagram1.Refresh(), in order increase the performance.

I could not get it your second point. Please provide the some more details about your requirement.

Regards,
Gowri


FR Felice Russo July 31, 2009 10:36 AM UTC

Hi Gowri,

see the attachment for disconnection operation on connector.
I should need to avoid this kind of operation, but I need to select connector for properties.

Regards,
Felice




disconnect_5a08bf5c.exe


GM Gowri Manohari D Syncfusion Team July 31, 2009 11:31 AM UTC

Hi Felice,

Thank you for the update.Please use the below code snippet for your requirement.

LineConnector ln = new LineConnector(PointF.Empty, PointF.Empty);
ln.HeadEndPoint.AllowMoveX = false;
ln.HeadEndPoint.AllowMoveY = false;
ln.TailEndPoint.AllowMoveX = false;
ln.TailEndPoint.AllowMoveY = false;

The above code will disable the endpoint movements. Let me know whether the above solution meets your requirement.

Regards,
Gowri


FR Felice Russo July 31, 2009 12:30 PM UTC

Hi Gowri,

ok, for your hints, they match my needs.

Getting back to orthogonal connector.

If I have more orthogonal connectors attached to a diagram node, they are overlapped.
Is there a way to space out tail/end-points of each connector?
See the attachment for a sample.
I have a node with more connector but I can't see each one.
Any suggest?

Regards,
Felice



orthogonal_504ec50d.exe


FR Felice Russo August 2, 2009 12:37 PM UTC

Hi Gowri,

I would like to handle "pointer" and "panning" cursor simultaneously.

When the cursor is over a text node it handles selection and dragging. When the cursor is over a page area it handles panning of diagram.
...I need both "PanTool" and "SelectTool" active...based on cursor position...

Is it possible?
Can You give me any hint about?

Regards,
Felice


FR Felice Russo August 2, 2009 12:56 PM UTC

Hi Gowri,

I need some info about "SymmetricLayoutManager" and SpringFactor, SpringLength and MaxIteraction.

I have used it for laying-out my diagram.
When I have 100 table (textnodes) with the following:
SpringFactor=0,3
SpringLenght=600
MaxIteraction=100
the diagram seems good.
When I have 1000 table (textnodes) with the same settings it's wrong and tables overlap.
What's the meaning of this 3 parameter and how should I use they?

Regards,
Felice


GM Gowri Manohari D Syncfusion Team August 3, 2009 01:26 PM UTC


Hi Felice,

1. We have already logged Feature Request for your first requirement. That is avoid Connection Overlapping.

2. For your second requirement I have provided the code snippet. Please make use of it.

private void diagram1_MouseMove(object sender, MouseEventArgs e)
{
Node n = (Node)diagram1.Controller.GetNodeUnderMouse(e.Location);
if (n != null && n is Syncfusion.Windows.Forms.Diagram.TextNode)
{
diagram1.Controller.ActivateTool("SelectTool");
}
else
{
diagram1.Controller.ActivateTool("PanTool");
}
}

3.For your third requirement

SpringFactor - Minimum distance between the connected nodes
SpringLength – Distance between the connected nodes.
MaxIteraction – Maximum count of iteraction of node layouting.

Regards,
Gowri


FR Felice Russo August 3, 2009 07:19 PM UTC

Hi Gowri,

You hints are good!

1) I will wait for it...
2) Ok
3) about minimum distance between the connected nodes, what does it mean 0,3? Why is it decimal?

4) I have tried Your previous hint using the following code snippet

---
LineConnector ln = new LineConnector(PointF.Empty, PointF.Empty);

ln.EditStyle.AllowMoveX = false;
ln.EditStyle.AllowMoveY = false;

ln.HeadEndPoint.AllowMoveX = false;
ln.HeadEndPoint.AllowMoveY = false;
ln.TailEndPoint.AllowMoveX = false;
ln.TailEndPoint.AllowMoveY = false;
---

for avoiding disconnecting connector from nodes. It's OK for disconnecting but when I select both textnodes and their connector I can't move/drag the selection.

Removing the code lines
---
ln.EditStyle.AllowMoveX = false;
ln.EditStyle.AllowMoveY = false;
---
it's ok.
I should need multi selection...
Any hints?

Regards,
Felice


GM Gowri Manohari D Syncfusion Team August 4, 2009 12:16 PM UTC

Hi Felice,

For your first requirement Spring factor accepts decimal values because it indicates minimum distance between the nodes.

For your second requirement, you can select more than one node at a time by using the functionality ctrl key+left mouse button like in other application.

Regards,
Gowri



FR Felice Russo August 6, 2009 07:04 PM UTC

Hi Gowri,

see the attachment for details.
If I select a single textnode I can drag (or move) it.
If I select more textnodes (for moving) it doesn't drag (or move).

I have set the following code lines for connector.
---
LineConnector ln = new LineConnector(PointF.Empty, PointF.Empty);

ln.EditStyle.AllowMoveX = false;
ln.EditStyle.AllowMoveY = false;
___

If I set AllowMoveX/Y = true I can drag and move selected textnodes.

Regards,
Felice



nodrag_52178c7e.exe


FR Felice Russo August 11, 2009 07:26 PM UTC

Hi Gowri,

I have a DB with about 1000 tables. The load operation takes minutes. It's too long!
Can I load and create diagram nodes in a thread, updating UI progressively?
So the user can use the application while the thread complete operation...and eventually he can abort it.

Regards,
Felice


FR Felice Russo August 11, 2009 07:33 PM UTC

Hi Gowri,

the function SizeToText() compute erroneously the height of the text.
See the attachment for details.
There is a space after the field "Note". If the table contain 2/3/4 fields the height seem right.
More field more tail space.
Any hint?

Regards,
Felice



errorHeight_20617196.exe


GM Gowri Manohari D Syncfusion Team August 12, 2009 05:12 AM UTC

Hi Felice,

1. For your first requirement, I have seen the attached file. In that you are selecting the TextNode using selection rectangle that time the connectors which are connected to TextNodes also selected. But you have set Connector.AllowMoveX and Connector.AllowMoveY to false. So that you could not move the textnodes in that case.

For that you should use multiple selection with the help of Ctrl + Mouse Left Key. Select the textnodes individually and move it.


2. For your second requirement, we have already logged Feature Request for this issue, that is loading diagram nodes using Thread.

Regards,
Gowri.


FR Felice Russo August 31, 2009 07:38 PM UTC

Hi Gowri,

I'm back! :-)

1) It's ok. So I must select textnodes and not connectors for moving.
But...what about selection rectangle? Can't I use it for fast selection? If I need to select 40 tables for reordering diagram it can be useful scaling out diagram...

2) Ok. I will wait for it.

Any suggest about the post dated:

---
Felice Russo at 8/11/2009 3:33:07 PM:
---
the function SizeToText() compute erroneously the height of the text.
See the attachment for details.
There is a space after the field "Note". If the table contain 2/3/4 fields the height seem right.
More field more tail space.
---

Any hint?

Regards,
Felice


GM Gowri Manohari D Syncfusion Team September 2, 2009 09:04 AM UTC

Hi Felice,

Thank you for your update.

The issue which you have mentioned is suspected as defect.And we have logged the defect report for this issue.

Regards,
Gowri



FR Felice Russo September 12, 2009 04:12 PM UTC

Hi Gowri,

I'm trying to put a text over/near a connector.

I have 2 methods:
1) using labels available on connector
2) using a TextNode grouped with connector

Using them arise the following problem:
1) the text rotates togheter with connector It's unreadable when rotated (see attachment).
2) the TextNode can go far from connector (see attachment).

I expect text will remain horizontal, readable and near connector during drag operation.

Have You any suggest?

Regards,
Felice



connectorlabel_79e31a35.zip


GM Gowri Manohari D Syncfusion Team September 14, 2009 05:59 AM UTC

Hi Felice,

1. Currently diagram control does not support the feature which you have mentioned in the first point. For that we have created workaround with Customized Label class, it will show the label in horizontal direction when connector is rotated. Please download the sample from below link.

http://files.syncfusion.com/support/Diagram.Windows/Incidents/I56446/main.htm

2. The normal behavior of the Group while rotating individual nodes in the group it wont affect other nodes. That is when you move the connected nodes it affect only the connector not the textnode of the Group. That's why TextNode did not move when the lineconnetcor is getting moved.

Let me know the above answer solves your issue.

Regards,
Gowri



FR Felice Russo September 21, 2009 07:37 PM UTC

Hi Gowri,

Ok, for Your answer.
I will try that!

Regards,
Felice


GM Gowri Manohari D Syncfusion Team September 22, 2009 05:16 AM UTC

Hi Felice,

Thank you for the update.

Regards,
Gowri


AD Administrator Syncfusion Team July 1, 2010 04:56 AM UTC

Hi,

I'd like to take a look at the example you've provided but the link is no longer valid:

http://files.syncfusion.com/support/Diagram.Windows/Forums/F56465_new/main.htm

Any chance you can give me the new url?

Thanks!
-Andrew


JB Jaffersathick B Syncfusion Team July 2, 2010 04:07 AM UTC

Hi Andrew,

You can download the sample from the following link:

http://files.syncfusion.com/support/Diagram.Windows/Forums/F56465_new/Diagram_WF_DatabaseDesign.zip


Thanks for using Syncfusion products and let me know if you have any other concerns.

Regards,
Jaffer.B


SA Sachin April 30, 2014 07:09 PM UTC

http://files.syncfusion.com/support/Diagram.Windows/Forums/F56465_new/main.htm

i would like to download the above example, but the link isn't working!

Loader.
Live Chat Icon For mobile
Up arrow icon