Raven DB session management in WCF
-
26-10-2019 - |
Pergunta
I have a WCF service that accepts requests, performs some work and saves result to Raven DB. I am thinking that the session management shall be similar to NHibernate with WCF, but I am not sure. Currently I am thinking of creating one session per WCF request.
Any other recomendations?
Solução
Yes, from session management perspective, you can use all the NHibernate practices. So session management for RavenDB in WCF is identical to how you do that with NHibernate
In concrete terms, that means using a per call instance mode and creating the session before the call and calling SaveChanges() and dispose after the call.
Outras dicas
Well it's really going to depend on your use case, but for the best scalability you should give preference to the per-call instance mode.