-->
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.  [ 4 posts ] 
Author Message
 Post subject: NHibernate and WCF
PostPosted: Thu May 31, 2007 1:25 pm 
Beginner
Beginner

Joined: Thu May 31, 2007 1:19 pm
Posts: 23
Hi

I am trying to get NHibernate working with WCF. Originally I was hoping to be able to create a contract that implemented methods of ISession.

Unfortunately, this seems not to work, as the CreateCriteria method requires a generic Type parameter. I get this error:

There was an error while trying to serialize parameter http://tempuri.org/:persistentClass. The InnerException message was 'Type 'System.RuntimeType' with data contract name 'RuntimeType:http://schemas.datacontract.org/2004/07/System' is not expected

Is the only way for me to create my custom objects on the server and pass them to the client?

I would really appreciate anyone with experience of getting NHibernate working with WCF giving me some pointers here!

Thanks,
Mark.


Top
 Profile  
 
 Post subject:
PostPosted: Thu May 31, 2007 6:39 pm 
Newbie

Joined: Wed May 30, 2007 8:18 am
Posts: 12
I did that in one project i.e. using nhibernate and WCF together. Make sure all your mapped classes allow serialisation or implement ISerializeable. By all I mean ALL those which have to pass between server and client.

.Net will serialise nested objects also and if any class does not allow serialisation, it will cause exception to be thrown.


Top
 Profile  
 
 Post subject:
PostPosted: Thu May 31, 2007 9:33 pm 
Regular
Regular

Joined: Tue Aug 08, 2006 4:28 am
Posts: 96
Location: Hong Kong
I am also trying to setup a WCF + NHibernate system. I found this quite useful. http://lunaverse.wordpress.com/2007/05/09/remoting-using-wcf-and-nhibernate/


Top
 Profile  
 
 Post subject:
PostPosted: Fri Jun 01, 2007 6:35 am 
Beginner
Beginner

Joined: Thu May 31, 2007 1:19 pm
Posts: 23
Thanks for the responses.

One thing that occurred to me: If the ISession exsists on the server, surely this is where the object cache will exist too?

To me, one of the big benefits of using an ORM is to have objects cached on the client.

Having only used one other ORM, DevExpress persistent objects, this supported having the data serialized via a service contract but in all other respects, the caching/lazy loading logic sat on the Client. Unfortunately, the DevExpress tool is far from mature in other respects!

To put it simply: I don't want a SQLServer or Oracle connection string on the client because I don't want the security/firewall/DB admin/Politics issues of the client PC talking straight to the database - it needs to go via an application-specific Remoting/WCF/WebService channel, but it still needs to have all the benefits of ORM performances :)


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

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.