I'm using NHibernate to access the database.
NHibernate has a function to get a list of all elements of a persisted class (select * from table).
The list it returns is an arraylist of objects of that persisted class, but I want to convert that arraylist to a dataset
I tried to XmlSerialize the arraylist but it keeps failing (Type not expected)
Binary serializing works but then I can't deserialize to a DataSet
I hope you guys can help me out it's drivin' me nuts !!
-
-
First of all: NHibernate - :-! no further comments

Second: you are serializing an ArrayList and want to deserialize it as DataSet or what? -
I have an ArrayList and I want to convert it to a DataSet through serializing the ArrayList (XmlSerializer)
I found the problem:
The class of the objects that are in the ArrayList contain a property that returns a Collection (Nhibernate.Collection.Set)
If I use on that property the XmlIgnore attribute it serializes perfect, but without the Collection...
Is there a way to include that collection into the serialized XmlSchema?
btw: U don't like Object/relational mapping or you just don't like Nhibernate ?
---------------------
Or is there a method to use an ArrayList as DataSource of a DataGrid, so it allows sorting (wich isn't the case if you bind an ArrayList to a DataSource) -
DiViNO wrote:btw: U don't like Object/relational mapping or you just don't like Nhibernate ?

He's a developer of a competing framework (hint: username matches site).
-
sbc wrote:

DiViNO wrote: btw: U don't like Object/relational mapping or you just don't like Nhibernate ? 
He's a developer of a competing framework (hint: username matches site).
It's not that. I don't know, i don't like the NHibernate port for .NET. It's to much JAVA-alike for me. You have to do the mapping in xml etc... That's java practise not .NET!
There are also other nice frameworks out there, not only mine. For example XPO or others... -
littleguru wrote:

sbc wrote: 
DiViNO wrote: btw: U don't like Object/relational mapping or you just don't like Nhibernate ? 
He's a developer of a competing framework (hint: username matches site).
It's not that. I don't know, i don't like the NHibernate port for .NET. It's to much JAVA-alike for me. You have to do the mapping in xml etc... That's java practise not .NET!
Perhaps it is to encourage Java developers to .NET - after all it is based on Hibernate (which is a Java framework). Would be strange if NHibernate was not Java-like.
-
sbc wrote:
Perhaps it is to encourage Java developers to .NET - after all it is based on Hibernate (which is a Java framework). Would be strange if NHibernate was not Java-like.
It isn't strange to have to change to a Java mind-set when using a .NET library?
-
littleguru wrote:It's not that. I don't know, i don't like the NHibernate port for .NET. It's to much JAVA-alike for me. You have to do the mapping in xml etc... That's java practise not .NET!
There are also other nice frameworks out there, not only mine. For example XPO or others...
You're right.
I don't get why you have to declare your relationships again in the xml files, they are already defined in the database!
Aren't there any frameworks that reflect your database schema and put them into businesslogic?
I took NHibernate because it's open source.
LLBLGEN looks very nice, but has it's cost also. -
Have not tried it, but what about using
ArrayList.ToArray(type)
and serialising that? If type is set to the correct object in the arraylist it ought to work.
If not, try casting it to an array and then serialising that:
Ctype(ArrayList.ToArray(type), type())
Thread Closed
This thread is kinda stale and has been closed but if you'd like to continue the conversation, please create a new thread in our Forums,
or Contact Us and let us know.