views:

404

answers:

1

I have a 3 tiered app: 1st layer: SQL DB. 2nd layer: App Sever (dotnet) 3rd layer: smart wpf client.

I'm using NHibarnate (fluent) as the data source for the application server layer (App server- 2nd layer talks to DB using NH)

Application layer talks to the client using WCF.

Do I benefit anything from using NH - as WCF doesn't support NH lazy loading (at least it doesn't look like this) and - if I use a static session object - I have to make the server single instance single concurrency - otherwise things get messy inside NH when more than one call comes at the same time. If I open a session object (NH) for each call and close it at the end of the call - I loose the NHibarante 1st level cache...

So - The question is - am I implementing NH wrong ? or is it not suppose to be efficient in my kind of project ?

+2  A: 

You may want to check out the uNhAddIns WCF project. It uses session-per-call, as that is the recommended way to go with WCF.

You are correct in saying that there is no lazy load via WCF. You need to fill out the object graph to the level you need and then send it on its way. If your service layer isn't object oriented in behavior NHibernate may be overkill. That's a tough call without a lot more context.

Daniel Auger
I think that there is something that solved this in wcf 4.0 (dot net 4.0) but I've got no time to check it.
Dani