How to store objects created with C# in database in .NET Framework

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I want to store the objects that i create in run time in database. In a way
that, for a product a create an object from a class written with C#, define
its properties and functions that it has, and want to store it in a database
(SQL Server 2K). I want the columns to be created and filled dynamically when
an object is inserted in db (Just like in J2EE, which is called i think
relational mapping, or something like this).

How can I do that?
 
May this helps you,
- Serialize your object at run-time using binary formatter into byte stream
- Store the binary data into sql server database as BLOB like how you store
images etc as binary data
- On extraction, get the binary data stream as byte[] and deseializer it to
get actual object

Or You may want to use the way given in the following link,
http://www.codeproject.com/cs/database/persistedobject.asp

HTH,
 
Back
Top