Saving layout to database


I am currently implementing an application using the Docking Frames library.

The application currently saves the workspace layout to a file in the C: emp folder. This is a short term solution. In the long term I wish to save the layout to a database using an existing table called user profile which has a path key (String length=255) and a value (String length=100). What I plan to do is to implement a database encoding for the layout which is independent of the docking frames technology which will work with other similar technologies. One option which is not available is saving the layout as a BLOB or similar database type. The information must be encoded using path key and value pairs.

One of my ideas to do this may be to encode the format in XML and take the data from there and persist it in the database. When restoring the layout I would take the data out of the table and put it back into a new XML structure and create the layout from this. If anyone has any better ideas please could you tell me them?

Can you tell me if this seems possible and if you have any ideas as to how it could be implemented?

Any help would be gratefully received.

Cheers, George.

100 Characters? That is not much… the framework produces a lot more data. The framework has no restrictions for the length of identifiers, so you’d have be prepared for some values that need more than 100 characters. Even worse, there is also no restriction of how deep the xml of a layout can be nested, so keys with length > 255 are possible as well. And don’t forget that xml is no database, keys can appear more than once and the order in which the tags appear may be important.

Bottom line: locigally splitting up the xml will be a nightmare. But since noone will ever read the database and extract the layout manually, why not implement a system that takes a large string (more than 100 characters), splits the string and stores the parts in the database? May not be pretty, but easier and safer than anything else.


Thanks for your speedy response and sorry for my late reply!

I’ll give what you have suggested a try. My boss wants a ‘docking component’ independent approach. I think I’ll start by implementing a system which is tied down to the docking frames library and then try from there.

Cheers, George.