Nels: okay, that's good to know. With binary serialization I never had that problem. Also, I'm hoping not to have to go through this. ;-)
gert wrote:
I do not understand, how can the lifeness of objects affect the serialization? The referenced object is either alive or it is a proxy which implements lazy-loading, i.e. fetches data from database as soon as someone (the serialization logic) touches something that needs to be fetched. So, as much as seriualization is concerned, all objects are acting "alive".
What is 'alive'? It is the fact that nhibernate is going to step in as soon as i hit something that was not there before?? Well, nhibernate does that by giving a 'nhibernate.bag' or list as the collection and letting the developer talk to the collection as an iList. By serializing as an iList, it should not come back as an nhibernate.bag. I don't even have nhibernate.dll's on my client.
Quote:
Maybe You should describe how Your code is failing... (like compilation/runtime error)
Good idea: (following classes were made to pinpoint my problem).
I have a class 'Book' which has a collection 'Pages'. Each 'Page' object has a property 'motherBook': the book it belongs to.
When I serialize myself, the xmlformatter creates this beauty:
<?xml version="1.0" encoding="utf-8" ?>
- <Book xmlns:i="http://www.w3.org/2001/XMLSchema-instance" z:Id="1" z:ClrType="ConsoleApplication1.Book" z:ClrAssembly="ConsoleApplication1, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null" xmlns:z="http://schemas.microsoft.com/2003/10/Serialization/" xmlns="http://schemas.datacontract.org/2004/07/ConsoleApplication1">
<amountPages>200</amountPages>
- <paginas z:Id="2">
- <_items z:Id="3" z:Size="1">
- <Page z:Id="4">
<amountWords>3000</amountWords>
<motherBook z:Ref="1" i:nil="true" />
</Page>
</_items>
<_size>1</_size>
<_version>1</_version>
</paginas>
</Book>
I can also deserialize this...
Do you see the 'z-Id' that is being generated and the z:ref ?
However, when I use a netTcp binding as my endpoint and have the above class 'Book' as a returnvalue in an indigo server/client application, the client bombs with an unexpected fault/exception. There is the mention of the stream not being okay, but absolutely nothing usefull.
If I switch to rpc-style communication, it works.