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

Drill Down and Shape custom properties databse persistence

Good morning,
I’m evaluating Syncfusion winforms diagram library.
I have some requisites that I could not verify looking at documents and samples.
1. I need to implement a top down diagram structure. The behavior is similar to drill down example. Expanding a node I need to navigate to another diagram persisted on file system or database. Could you help me to understand how to do it?
2. I would like to use diagrams to implement a graphical data input. My idea is to create custom shapes with custom properties, and bind such properties to existing database tables. Have you an example to solve a problem like this?
Thank you very much
Domenico Mozzone

9 Replies

DM Dinesh M Syncfusion Team November 25, 2009 01:16 PM UTC

Hi Domenico,

We will update you with a sample for this requirement in 1 business day.

Thank you for your patience.

Regards,
Dinesh


DM Domenico Mozzone November 26, 2009 03:17 PM UTC

Thank you Dinesh.
Meanwhile I focused my requisites. As I have an sql database with “nodes” and “connectors” tables I tried in vain to save a custom Symbol (derived by your Syncfusion sample CustomSymbol_2008) into Nodes table. I tried different ways but I did not succeeded in finding the correct way to:
1. Create an sql database table to save custom symbols
2. To extend custom symbol in order to be persisted (I’m using a LINQ to SQL Datacontext)
So my new questions are:
- How can I save (and read into a diagram) custom symbols, with custom properties, to sql database table?
- How can I customize the behavior and properties of a symbol designed with the Essential Diagram symbol designer by subclassifying it at application level? The custom symbol example provided with Syncfusione demo seems to do such, reading explanation, but looking at code I can’t understand how the task is performed: it seems that the custom symbol is build using only code, not subclassifying it using a symbol designer Essential Diagram symbol designer.
These points are key features for my application.
Best Regards


DM Dinesh M Syncfusion Team November 26, 2009 04:30 PM UTC

Hi Domenico,

Sorry for the delay in getting back to you.

I have prepared a sample that meets some of your requirement that you have mentioned in your first post.
1. Gets data required to create nodes from SQL.
2. Position nodes with a top down diagram structure using DirectedTreeLayout Manager.
3. You can drill down a level by means of double clicking it.
4. I have a separate class "Employee", and this acts as a interface between the nodes and database.

I will modify my sample further to use a custom symbol that shows the properties of Employee class in the property editor for a node.
However a symbol designed using SymbolDesigner cannot be made to have custom properties and hence we need to derive existing class as in "CustomSymbols" demo.

Regards,
Dinesh



Diagram_WF_DT_e45fed47.zip


DM Domenico Mozzone November 26, 2009 04:59 PM UTC

Thank you very much Dinesh.
I’m examining your example. I think that it will solve part of my needs.
In your further modification mentioned in your reply please take into consideration also that I should save (and read into a diagram) custom symbols, with custom properties, to sql database table. Till now I can’t succeeded in this task. I suppose that I miss something converting the custom symbol (derived from Group) into an object that can be saved in sql database table (I tried byte array).
Thank you Dinesh
Bst Regards,
Domenico


DM Domenico Mozzone November 27, 2009 11:31 AM UTC

Hi Dinesh,
I succeeded in persisting diagram symbols (Mysymbol object taken from a Syncfusion example) on a SQL Database.
Please see attached solution.
The custom symbol has a simple property that seems not to be correctly: if I change the property (clicking on the symbol) I can see the changed, but when I save and reload from database the property is always set to 0. Where’s my error(s)?
Thank you
Best Regards
Domenico




TestDBSymbolPerist_6426ac51.zip


DM Domenico Mozzone November 27, 2009 01:39 PM UTC

I'm sorry.
I forgot the override of GetObjectData...
adding
protected override void GetObjectData(SerializationInfo info, StreamingContext context)
{
base.GetObjectData(info, context);
info.AddValue("clickCount", clickCount, clickCount.GetType());
}

and modifying serialization constructor
protected MySymbol(SerializationInfo info, StreamingContext context)
: base(info, context)
{
ClickCount = (int)info.GetValue("clickCount", typeof(int));
}
aleso the property is correctly persisted into sql database.

Best Regards
Domenico


DM Dinesh M Syncfusion Team November 30, 2009 12:55 PM UTC

Hi Domenico,

Please check the attached sample which might also help you in making the custom properties to be separated out to a new class.

Let me know if you have any questions.

Regards,
Dinesh



CustomProperty_a190f8b9.zip


DM Domenico Mozzone November 30, 2009 02:08 PM UTC

Thank you very much.
I had to modify the serialization constructor of supportive class for the _customValue in
_customValue = float.Parse(entry.Value.ToString());
to avoid a serialization error.
Now I'm trying to binary serialize on sql database table, using you example.
Best Regards
Domenico


DM Dinesh M Syncfusion Team December 1, 2009 12:49 PM UTC

Hi Domenico,

Thanks for the update.

Regards,
Dinesh

Loader.
Live Chat Icon For mobile
Up arrow icon