Hi, I have implemented a WCF service that uses the DomainFactory, SessionProvidingBehavior and SessionProvidingInvoker as in the Xtensive.Storage examples. The domain gets build ok but having a Session instance is an issue. I added a custom Session.Resolver that looks like this:
It seems to cause a loop. Using al these standard code and samples of X-Tensive, I wonder what I can and cannot do in this resolver. Could you clarify some things for me here? And maybe there is a standard resolver available within DO4.5 which can be used? |
Hello, Jos Your solution seems weird to me. Let me explain some session activation magic first. Any session in dataobjects.net could be made active.
Active session is implicitly available via Session.Current static property. Behind the scene it is stored in It's important to know that once session is activated reference to it is stored in thread-static field, so you should deactivate your session, when it is not longer required otherwise you will leak some memory. Session activation is stackable. This means you can activate many sessions, the most recently activated one would be returned by Session.Current
DataObjects.Net 4.5 do not activate sessions by default, so SessionProvidingInvoker should be changed to activate newly created session:
You might also consider providing transaction as well:
|