Tutorial :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.


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.

Note:If u also have question or solution just comment us below or mail us on toontricks1994@gmail.com
Next Post »