These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 
Author Message
 Post subject: NHib + WCF + Partial trust
PostPosted: Tue Apr 15, 2008 12:55 pm 
Newbie

Joined: Tue Apr 15, 2008 12:15 pm
Posts: 1
I have a traditional server client model. The client is a partial trusted xbap application (.net 3.5). The client communicates with WCF to the server (basic http is the only allowed protocol for partial trust),

I am trying to send the domain objects as constructed by nhibernate from the server to the client. The domain objects are fully loaded (both the class as members are never lazy).

To use WCF with hibernate I have read that one should use the NETDataContractSerializer, unfortunately this serializer is not supported for collections with partial trust. Basically I am stuck with the "default" DataContractSerializer which serializes all collections

All goes well except for collections, the PersistentGenericBag (the wrapper for lists) cannot be deserialized on the partial trusted client since it:

    A does not have a datacontract + datamembers
    B there are private members with should be serialized

What I have tried as solutions:
    - Replacing all GenericBag objects by standard .NET collections (List etc) during serialization. This works for most cases, but one loses functionality like cascading (since the domain objects contain a large object graph this will result in pretty complex DAO classes)
    - Trying to wrap the persistentbag by by a custom usercollection type.

Personally I think the best solution is to wrap a GenericBag in a customusercollection and add a datacontract to the wrapper (and doing some tricks like initializing a new genericbag on deserialization etc)
However when I extend a GenericBag all seems to work, if I wrap The genericbag (by implememting it's interfaces IPersistenCollection, IList<T> and IList>) I get an exception:
NHibernate.AssertionFailure: collection added twice
during the reattachment of the collection to the current hibernate session.
Extending won't do the job, I need to wrap the persistentgenericbag to create a valid datacontract.

Does anybody have a working solution for serializing the genericbags with partial trust through WCF?

Hibernate version:
1.21GA


    Top
     Profile  
     
    Display posts from previous:  Sort by  
    Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 

    All times are UTC - 5 hours [ DST ]


    You cannot post new topics in this forum
    You cannot reply to topics in this forum
    You cannot edit your posts in this forum
    You cannot delete your posts in this forum

    Search for:
    © Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.