This project is read-only.


Jan 20, 2012 at 7:26 PM


Could you tell me please if there is a way to save (serialize) an instance of DBDiff.Schema.SQLServer.Generates.Model.Database to disk?

It would be useful to save that db for later comparison. Currently I marked all classes as [Serializable] and using BinaryFormatter to do this. It seems working.

What do you think?

Thank you very much

Jan 22, 2012 at 6:03 AM

Hi deverion,

Thanks for your recommendation. I interpreted feature request 6338 ("Maintain the compared databases between executions") as requesting the functionality you are describing.

Your method of serializing using the BinaryFormatter sounds like it could be implemented quickly; if you would like to submit a patch (or just upload a .ZIP of the project with any publishable changes you've made) I would be happy to take a look at it. I'm not sure how you handle the user interface implications of a previously-scanned database.

Longer term, I have received requests to support the file format used by Visual Studio database projects... this is more work than binary serialization but an interoperable format would be ideal. I am not sure what other formats are out there for consideration. (The discussion 'Feature requests - CLI interface and saving diff results' mentions exporting the results of a comparison as HTML.)

Thanks again for your input!

Jan 22, 2012 at 1:05 PM


Actually I do not really need UI for this, because I am finding a way how to automatize release tasks.

That is why I would like to save the whole schema to a file and mark it that it is the Vxx.xx version of the db schema. (backing up the DB would also do the job, but it should be restored to have it compared again, let's say I would like to compare a really old schema to the newest, or the client's version to the dev version)

I do not really would like to upload it, because it might have some "play-code".
I really did a simple find/replace to all files:

public class -> [Serializable] public class
public sealed class -> [Serializable] public sealed class
(maybe some others, but the same way)

Serializer will tell you what classes have not been marked as serializable.

using (FileStream file = new FileStream(@"F:\test.dat", FileMode.Create))
      BinaryFormatter bf = new BinaryFormatter();
      bf.Serialize(file, db);

I do not care about the file format, but I think the best would be some kind of XML, since BinaryFormatter stores a lot of "useless" info. I mean "useless" from the schema point of view.

And the XML format can be compressed very well.

So, thank you again!