简体   繁体   English

SharpRepository + OptimisticConcurrency

[英]SharpRepository + OptimisticConcurrency

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? 还是默认情况下以这种方式配置?

I'm assuming you are talking about the RaveDbRepository based on the question. 我假设您基于该问题正在谈论RaveDbRepository。

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. 目前,无法通过使用SharpRepository来满足许多RavenDb的特定需求,但是我们希望达到这一点。

Currently, a document store is used to instantiate the RavenDbRepository which is then used to create the IDocumentSession (by calling documentStore.OpenSession()). 当前,文档存储用于实例化RavenDbRepository,然后将其用于创建IDocumentSession(通过调用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. 请为此在GitHub上发布一个问题,我们将进行研究。 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. 允许对IDocumentSession的公共访问或受保护访问,以便您可以直接访问会话,也可以在继承的类中访问该会话并设置该标志。

  • 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. 允许从IDocumentSesison而不是DocumentStore实例化RavenDbRepository,以便可以在创建存储库时进行设置。

  • Somehow work these into the default conventions, though I'm not sure how. 尽管我不确定如何将它们按默认约定工作。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM