Chen Kinnrot
Chen Kinnrot

Reputation: 21015

WCF FluentNhibernate Session managment and cache

i'm trying to understand how and if its possible to keep a session open on a wcf service.

the problem is that if i select an entity and pass it to the client and than return it to the server with the same session, i get an exception cause session dont know this entity any more (the reference changed because of wcf).

so i have to open a new session for updates, when i open a new session i loose the greate cache mechanizm of nhibernate.

what can i do to solve this?

i want to keep the cache i dont care if i need to open session for each call.

Upvotes: 0

Views: 589

Answers (1)

Aaron Fischer
Aaron Fischer

Reputation: 21211

Typically you would use a session per call with wcf. When you receive your entity back from the client you should be able to call Session.Merge( entity) and do the work you need.

Upvotes: 1

Related Questions