Sign in to follow this  

[web] Representing Objects in a Database (MS SQL 2005)

This topic is 3742 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I want to be able to dynamically represent objects in a database. It can be a table or two per object type, but I would still like to be able to make an easy way to manage my objects. Is there any easier way than writing a custom class that uses reflection to create and manage (update, create new ones, remove some, etc) each column in a table, relating something like the "Text" property of an object to the "ObjectTypeText" column? I am using ASP.NET and MS SQL 2005.

Share this post


Link to post
Share on other sites
Quote:
Original post by viblo
One way would be to make your object serializable and put the serialized xml in the database. Or am I missing something?


I thought about doing this, but it defeats the purpose of having the database. With the pure database backend, you can do SQL statements. I already have an Xml backend that stores the objects in Xml files on disk (and keeps them in memory), but you can't do anything other than basic Select, update, insert and remove statements.

Share this post


Link to post
Share on other sites
SQL Server 2005 supports storing native .NET objects in tables. You have to do a little work to get your objects working that way (serialize and deserialization are required), however you can then call methods on those objects from SQL. Not that I would recommend such behavior, generally you should attempt to seperate data-storage from business logic. Although as a data-layer it might be effective.

Share this post


Link to post
Share on other sites

This topic is 3742 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this