Question

Wondering if there is any way to set the save/update operation of a repository to use optimistic concurrency? Haven't seen any method to do this? Or maybe it's configured this way by default?

Was it helpful?

Solution

I'm assuming you are talking about the RaveDbRepository based on the question.

Unfortunately, right now there isn't a way to do that. Many of the RavenDb specific needs can't currently be addressed through using SharpRepository to interface with it, but we would like to get to that point.

Currently, a document store is used to instantiate the RavenDbRepository which is then used to create the IDocumentSession (by calling documentStore.OpenSession()). Since the flag for using optimistic concurrency is on the session itself there currently isn't a great way to handle this.

Please post an issue on GitHub for us about this and we'll look into making it happen. Off the top of my head we have some options:

  • Allow public or protected access to IDocumentSession so that you could access the session directly or in an inherited class and set that flag.

  • Allow the ability to instantiate a RavenDbRepository from a IDocumentSesison instead of a DocumentStore, so that the settings could be made while creating the repository.

  • Somehow work these into the default conventions, though I'm not sure how.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top