Note that there are some explanatory texts on larger screens.

plurals
  1. POThe best way to store class instances to a file/database
    primarykey
    data
    text
    <p>What is the best way to store instances of a class to file/database?</p> <p>We have a base class called Command and loads of derived classes. Users create instances of these classes by adding commands to a graphical designer where they can configure them. (Set the properties).</p> <p>We then need a way to store these "commands" to a file without losing any information.</p> <p>One idea was to use db4o, but the GPL license is not acceptable for this project.</p> <p>Any suggestions or code samples?</p> <p>Update:</p> <p>(In order to "de-blurryfie" my question :p)</p> <p>The generated code might look something like:</p> <pre><code> command[i++] = new DelayInSecondsCommand(2); command[i++] = new DaliRequestCommand(1, false, 254); command[i++] = new DaliRequestCommand(2, false, 254); command[i++] = new DaliRequestCommand(3, false, 254); command[i++] = new WaitInSecondsCommand(2); command[i++] = new DaliRequestCommand(1, false, 0); command[i++] = new DaliRequestCommand(2, false, 0); command[i++] = new DaliRequestCommand(3, false, 0); command[i++] = new JumpCommand(0); </code></pre> <p>But then with loads of different commands.</p> <p>I know it's possible with .NET serialization, altough I've never used it before, but I was wondering if there are better alternatives, like I said db4o seems nice but the license doesn't fit the project.</p> <p>Update 2:</p> <p>Thank you for the replies. I'll probably go with the serialization solution now, but I'll look into the other options as well. F.Y.I. data is stored in a SQL Compact database.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload