.NET Serialization: saving your object in a database... is this better than saving data in columns?
Posted on 2011-09-09
Hi, I have a question... possibly a stupid question, I'm not sure.
But, just started dabbling with serialization because I've created a website which savesinformation related to the user. So, in order to work with this data, I extract the user's information from the database, put it into my User object and then perform manipulations.
But, ultimately the data is stored in a standard table in an oracle database. So, of course I've just realised and managed to get working, the process of saving that data in the oracle table (BLOB field) as a serialized object. Then I can extract that serialized object directly without having to extract the information column by column.
So... knowing little about this and not really being able to see the possible difficulties down the road... I am just wondering to myself... why bother storing the data in standard format at all? Why not just do away with all the columns and only store the User object?
So why not? Well, I guess the obvious answer is that you can't run simple queries on your database anymore... and you're going to want to do that. But, I am just wondering whether I'm better off, not only storing the data in a standard column, but then including a User column at the end where I store my User object also. Then I can more or less build my code around extracting that object when I want to deal with a user's information... instead of extracting every column and building my Task object column by column in code.
What do the experts say?! What's the standard way people do these types of things?