Object serialization to database

Object serialization to database

Old forum URL: forums.lhotka.net/forums/t/5618.aspx


gurzaco posted on Friday, October 17, 2008

Hello ! This is my first post in the forum, but I was using CSLA since the beginning of this year.

I am working in a medium project (3 developers) using csla, wcsf and Nhibernate for a medical institution.. Since csla uses the concept of mobile object, using the serialization capabilities of the .NET framework, I was wondering if anyone have used this features of the framework to serialize business objects to a relational database instead of the conventional form using an ORM tool. Is it posible with the last version of CSLA?

I was doing a little researh on this topic, trying to discover the pros and cons of it. The most obvious disadvantage is the lose of integrity cheking and transactions. On the other hand, the mayor benefits are represented by trivial inserting/requesting operations from the database. Taking into account that we have now powerful tools like Linq and System.Transactions, would you considerer that binary object serialization to a relational database is an option to be considerer?

Thanks for any comments in this regard,

Gurzaco

tmg4340 replied on Friday, October 17, 2008

One of the larger issues I see is version tolerance.  By default, binary serialization is not version-tolerant.  So if you ever change your objects, you will either have to implement version-tolerant serialization (which requires code to be written every time your object changes), or develop a process that updates all the data in your database to the new object versions.

Also, remember that your data may be used by applications other than yours.  For example, reporting on the data with any other tool is almost impossible.  Sharing the data by means other than a web service (or other programming facade) that you put in front of the data is also going to be pretty tough.  By going the serialized-object route, you'll largely isolate your data from the rest of the organization, and you'll have to expend programming effort to get around that.  Perhaps that's not an issue, but it is something to think about.

HTH

- Scott

ajj3085 replied on Friday, October 17, 2008

Don't do it; serialization is meant to enable mobile objects, not to be used as a way to store data. 

Linq to sql really has nothing to do with serialization, but I have found L2S very useful to do queries and update the database. 

JoeFallon1 replied on Sunday, October 19, 2008

Scott was being polite. <g>

He meant to say what Andy said - "Don't do it."

I agree with both - it would be a huge mistake.

Joe

 

ajj3085 replied on Monday, October 20, 2008

Opps... I didn't mean to sound rude.. just firm.  Sorry if that's how I came off.

Copyright (c) Marimer LLC