-->
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.  [ 6 posts ] 
Author Message
 Post subject: How to use Remoting with NHIbernate?
PostPosted: Fri Jun 03, 2005 3:07 pm 
Newbie

Joined: Fri Jun 03, 2005 3:01 pm
Posts: 2
I have a large project and i need to use .net remoting, it


Top
 Profile  
 
 Post subject:
PostPosted: Fri Jun 03, 2005 7:27 pm 
Regular
Regular

Joined: Mon May 16, 2005 2:15 pm
Posts: 59
Sure, why not. :)


Top
 Profile  
 
 Post subject:
PostPosted: Sun Jun 05, 2005 2:28 pm 
Newbie

Joined: Fri Jun 03, 2005 3:01 pm
Posts: 2
Ok but i don


Top
 Profile  
 
 Post subject:
PostPosted: Sun Jun 05, 2005 6:50 pm 
Regular
Regular

Joined: Thu May 12, 2005 10:12 am
Posts: 71
Location: Buenos Aires, Argentina
It all depends on how you want to build you distributed architecture. Are you planning on using remoting, Component Services (COM+) or Web services. Later, are you planning on using DTO or you're OK with using POCO objects in your view.

My experience so far is that remoting is probably the worst issue in the .NET framework. MS send mixed signals about it's remoting technology and there are no clear guidelines on what to use. (if only Spring.NET were a little more developed)

Anyways, by your comment I can assume you want to using .NET Remoting. In this case you're going to need a Service layer to use as entry point to your business componente. In this scenario you'll want to start nhibernate session (plus transaction) and commit and close it when the method end.

In order to have NH session available down your execution path, you'll have to use a sort of PersistenceManager that will make the ISession available to your DAO implementation at one point or another. In ASP.NET you you normaly use the HTTPContext.Items to put the session and make it available in any part of your code. In Remoting (and other scenarios also) you can actually do this in a more "elegant" way by using Threading.Thread.CurrentContext.SetProperty method to put the session. (if you use Reflector on HTTPContext.Items you'll se this is exactly what ASP.NET does). At a later point you can retrieve the session using the Threading.Thread.CurrentContext.GetProperty (you'll probably have to learn about this in depth on your own on how to do it right for your case).

Regarding how should you transport your domain objects to the other end of the wire depends more on your architecture implementation. You can use your normal object (rememeber you can deatach them from the session), use DTO object or even passing entire parameters (ids, dates, etc)

I hope this gets you at least started and pointing in the right direction. Remoting is hard to do right in .NET, either with nhibernate or without it.

Good luck and keep us posted on your successes (and failures)

- Roni Burd


Top
 Profile  
 
 Post subject:
PostPosted: Thu Jun 23, 2005 1:11 pm 
I'm attempting to use remoting and my problem is with lazy loading. Passing serializable objects back and forth is easy enough, but passing proxies is a little more hairy.


Top
  
 
 Post subject:
PostPosted: Tue Jun 28, 2005 1:53 pm 
Newbie

Joined: Wed Jun 22, 2005 9:20 am
Posts: 4
It shouldnt. Which formatter are you using?

_________________
Cheers,
hammett
http://www.castleproject.org/~hammett


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 6 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.