I want to store objects that i create programmatically in C#, like in J2EE
(which is callad i think relational mapping or sometihng like this). I want
to create objects that i use for my enterprise applications and store them in
database after execution. And I want the columns and rows related to my
objects to be created and filled automatically.

How can i do that. Thanks?

Re: How to store C# objects in DB by Markus

Markus
Sun Dec 18 04:32:42 CST 2005

basulasz wrote:
> I want to store objects that i create programmatically in C#, like in J2EE
> (which is callad i think relational mapping or sometihng like this). I want
> to create objects that i use for my enterprise applications and store them in
> database after execution. And I want the columns and rows related to my
> objects to be created and filled automatically.
>
> How can i do that. Thanks?

There is nothing for that in the .NET framework. You'll need an object
database (look that up on google or wikipedia, there are quite a few
products for .net). I tried the ones from www.db4o.com and www.versant.com.

hth,
Max

Re: How to store C# objects in DB by James

James
Sun Dec 18 05:37:39 CST 2005


"Markus Stoeger" <spamhole@gmx.at> wrote in message
news:exwUi57AGHA.976@TK2MSFTNGP15.phx.gbl...
> basulasz wrote:
>> I want to store objects that i create programmatically in C#, like in
>> J2EE (which is callad i think relational mapping or sometihng like this).
>> I want to create objects that i use for my enterprise applications and
>> store them in database after execution. And I want the columns and rows
>> related to my objects to be created and filled automatically.
>>
>> How can i do that. Thanks?
>
> There is nothing for that in the .NET framework. You'll need an object
> database (look that up on google or wikipedia, there are quite a few
> products for .net). I tried the ones from www.db4o.com and
> www.versant.com.
>
> hth,
> Max

Hi, In Access you can use the OLE OBJECT type - I don't use SQL Server - but
sureely it has some equivalant ?

James



Re: How to store C# objects in DB by Markus

Markus
Sun Dec 18 05:57:30 CST 2005

James Jenkins wrote:
> "Markus Stoeger" <spamhole@gmx.at> wrote in message
> news:exwUi57AGHA.976@TK2MSFTNGP15.phx.gbl...
>
>>basulasz wrote:
>>
>>>I want to store objects that i create programmatically in C#, like in
>>>J2EE (which is callad i think relational mapping or sometihng like this).
>>>I want to create objects that i use for my enterprise applications and
>>>store them in database after execution. And I want the columns and rows
>>>related to my objects to be created and filled automatically.
>>>
>>>How can i do that. Thanks?
>>
>>There is nothing for that in the .NET framework. You'll need an object
>>database (look that up on google or wikipedia, there are quite a few
>>products for .net). I tried the ones from www.db4o.com and
>>www.versant.com.
>>
>>hth,
>>Max
>
>
> Hi, In Access you can use the OLE OBJECT type - I don't use SQL Server - but
> sureely it has some equivalant ?

How'd you store a C# object (instance of a class) in an OLE Object field
in Access? I could be wrong (or have misunderstood the OP), but I think
these are two completely different things.

Max

Re: How to store C# objects in DB by basulasz

basulasz
Sun Dec 18 06:28:02 CST 2005

Are there any sample code or article about this topic you know?

Thanks a lot..

"Markus Stoeger" wrote:

> James Jenkins wrote:
> > "Markus Stoeger" <spamhole@gmx.at> wrote in message
> > news:exwUi57AGHA.976@TK2MSFTNGP15.phx.gbl...
> >
> >>basulasz wrote:
> >>
> >>>I want to store objects that i create programmatically in C#, like in
> >>>J2EE (which is callad i think relational mapping or sometihng like this).
> >>>I want to create objects that i use for my enterprise applications and
> >>>store them in database after execution. And I want the columns and rows
> >>>related to my objects to be created and filled automatically.
> >>>
> >>>How can i do that. Thanks?
> >>
> >>There is nothing for that in the .NET framework. You'll need an object
> >>database (look that up on google or wikipedia, there are quite a few
> >>products for .net). I tried the ones from www.db4o.com and
> >>www.versant.com.
> >>
> >>hth,
> >>Max
> >
> >
> > Hi, In Access you can use the OLE OBJECT type - I don't use SQL Server - but
> > sureely it has some equivalant ?
>
> How'd you store a C# object (instance of a class) in an OLE Object field
> in Access? I could be wrong (or have misunderstood the OP), but I think
> these are two completely different things.
>
> Max
>

Re: How to store C# objects in DB by Frans

Frans
Mon Dec 19 03:17:19 CST 2005

Markus Stoeger wrote:

> James Jenkins wrote:
> > "Markus Stoeger" <spamhole@gmx.at> wrote in message
> > news:exwUi57AGHA.976@TK2MSFTNGP15.phx.gbl...
> >
> > > basulasz wrote:
> > >
> > > > I want to store objects that i create programmatically in C#,
> > > > like in J2EE (which is callad i think relational mapping or
> > > > sometihng like this). I want to create objects that i use for
> > > > my enterprise applications and store them in database after
> > > > execution. And I want the columns and rows related to my
> > > > objects to be created and filled automatically.
> > > >
> > > > How can i do that. Thanks?
> > >
> > > There is nothing for that in the .NET framework. You'll need an
> > > object database (look that up on google or wikipedia, there are
> > > quite a few products for .net). I tried the ones from
> > > www.db4o.com and www.versant.com.
> > >
> > > hth,
> > > Max
> >
> >
> > Hi, In Access you can use the OLE OBJECT type - I don't use SQL
> > Server - but sureely it has some equivalant ?
>
> How'd you store a C# object (instance of a class) in an OLE Object
> field in Access? I could be wrong (or have misunderstood the OP), but
> I think these are two completely different things.

serialize to memstream, read the bytes, store in the blob field. to
use it: read record, place bytes in memstream, deserialize.

FB

ps: versant's .net o/r mapper is now a separate company.

--
------------------------------------------------------------------------
Get LLBLGen Pro, productive O/R mapping for .NET: http://www.llblgen.com
My .NET blog: http://weblogs.asp.net/fbouma
Microsoft MVP (C#)
------------------------------------------------------------------------

Re: How to store C# objects in DB by Mahesh

Mahesh
Mon Dec 19 05:14:17 CST 2005

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,
"basulasz" <basulasz@discussions.microsoft.com> wrote in message
news:67964466-E8B7-4D6F-A3A9-43290EEE6BB6@microsoft.com...
> I want to store objects that i create programmatically in C#, like in J2EE
> (which is callad i think relational mapping or sometihng like this). I
want
> to create objects that i use for my enterprise applications and store them
in
> database after execution. And I want the columns and rows related to my
> objects to be created and filled automatically.
>
> How can i do that. Thanks?



Re: How to store C# objects in DB by Ignacio

Ignacio
Mon Dec 19 08:39:56 CST 2005

Hi,

In addition take a look at NHibernate
http://wiki.nhibernate.org/display/NH/Home


cheers,

--
Ignacio Machin,
ignacio.machin AT dot.state.fl.us
Florida Department Of Transportation



"Mahesh Devjibhai Dhola [MVP]" <dholamahesh@hotmail.com> wrote in message
news:%23$NhWwIBGHA.240@TK2MSFTNGP11.phx.gbl...
> 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,
> "basulasz" <basulasz@discussions.microsoft.com> wrote in message
> news:67964466-E8B7-4D6F-A3A9-43290EEE6BB6@microsoft.com...
>> I want to store objects that i create programmatically in C#, like in
>> J2EE
>> (which is callad i think relational mapping or sometihng like this). I
> want
>> to create objects that i use for my enterprise applications and store
>> them
> in
>> database after execution. And I want the columns and rows related to my
>> objects to be created and filled automatically.
>>
>> How can i do that. Thanks?
>
>



Re: How to store C# objects in DB by basulasz

basulasz
Mon Dec 19 13:35:03 CST 2005

Thanks a lot. Is Visual Studio 2005, or in other words .NET 2.0 supports
relational object mapping by default? Or can we do that by your instructions
by myself?

Thanks for help...

"Mahesh Devjibhai Dhola [MVP]" wrote:

> 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,
> "basulasz" <basulasz@discussions.microsoft.com> wrote in message
> news:67964466-E8B7-4D6F-A3A9-43290EEE6BB6@microsoft.com...
> > I want to store objects that i create programmatically in C#, like in J2EE
> > (which is callad i think relational mapping or sometihng like this). I
> want
> > to create objects that i use for my enterprise applications and store them
> in
> > database after execution. And I want the columns and rows related to my
> > objects to be created and filled automatically.
> >
> > How can i do that. Thanks?
>
>
>

Re: How to store C# objects in DB by Markus

Markus
Mon Dec 19 14:22:03 CST 2005

basulasz wrote:
> Thanks a lot. Is Visual Studio 2005, or in other words .NET 2.0 supports
> relational object mapping by default?

not that I know of.

> Or can we do that by your instructions by myself?

just wondering... do you need to run queries on the stored objects (like
retrieving all objects that have a field set to a certain value) or do
you simply want to store them so they can later be restored?

in the later case serializing the objects (using the BinaryFormatter or
similar) should be fine. If you need to run queries on the objects you
should choose something that does real o/r mapping for you.

Max

Re: How to store C# objects in DB by basulasz

basulasz
Mon Dec 19 15:22:01 CST 2005

Actually I want to use instances of my classes that i have stored. For a
product category i want to store properties of products. For example i have a
notebook category and hundreds of notebook items with different properties. I
want to store the data about them in db as persisted objects. I want to do
the task that "hibernate" do in J2EE (Or NHibernate in .NET) by myself.

"Markus Stoeger" wrote:

> basulasz wrote:
> > Thanks a lot. Is Visual Studio 2005, or in other words .NET 2.0 supports
> > relational object mapping by default?
>
> not that I know of.
>
> > Or can we do that by your instructions by myself?
>
> just wondering... do you need to run queries on the stored objects (like
> retrieving all objects that have a field set to a certain value) or do
> you simply want to store them so they can later be restored?
>
> in the later case serializing the objects (using the BinaryFormatter or
> similar) should be fine. If you need to run queries on the objects you
> should choose something that does real o/r mapping for you.
>
> Max
>

Re: How to store C# objects in DB by Frans

Frans
Tue Dec 20 02:13:49 CST 2005

basulasz wrote:

> Thanks a lot. Is Visual Studio 2005, or in other words .NET 2.0
> supports relational object mapping by default? Or can we do that by
> your instructions by myself?

There's no build in O/R mapper in .NET 2.0 / VS.NET 2005. You have to
use a 3rd party application for that, like LLBLGen Pro
(http://www.llblgen.com )

You can try yourself of course, however as it took me 3 years of 10
hours a day, 7 days a week, to write mine, I don't think it will be
feasable for anyone to 'do that for their current project'.

FB
--
------------------------------------------------------------------------
Get LLBLGen Pro, productive O/R mapping for .NET: http://www.llblgen.com
My .NET blog: http://weblogs.asp.net/fbouma
Microsoft MVP (C#)
------------------------------------------------------------------------
>
> Thanks for help...
>
> "Mahesh Devjibhai Dhola [MVP]" wrote:
>
> > 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,
> > "basulasz" <basulasz@discussions.microsoft.com> wrote in message
> > news:67964466-E8B7-4D6F-A3A9-43290EEE6BB6@microsoft.com...
> > > I want to store objects that i create programmatically in C#,
> > > like in J2EE (which is callad i think relational mapping or
> > > sometihng like this). I
> > want
> > > to create objects that i use for my enterprise applications and
> > > store them
> > in
> > > database after execution. And I want the columns and rows related
> > > to my objects to be created and filled automatically.
> > >
> > > How can i do that. Thanks?