membership provider using ravenDB
我正在尝试实现使用 ravenDB 的 .net 会员提供程序。我已经在我的 mvc4 应用程序中设置了 raven db,并且我认为我设置了正确的成员资格提供程序以使用 ravenDB,除了从成员资格提供程序调用文档存储。我发现使用以下
的示例
1
2 3 4 5 6 7 8 9 10 11 12 |
public IDocumentStore DocumentStore
{ get { if (documentStore == null) { throw new NullReferenceException(“The DocumentStore is not set. Please set the DocumentStore or make sure that the Common Service Locator can find the IDocumentStore and call Initialize on this provider.”); } return this.documentStore; } set { this.documentStore = value; } } |
因为我已经在 global.asax 文件中的 mvc 项目中设置了文档存储
1
2 3 4 5 6 7 8 |
public static IDocumentStore DocumentStore { get; private set; }
private static void CreateRavenDBDocumentStore() { DocumentStore = new DocumentStore { ConnectionStringName =“RavenDB” }.Initialize(); } |
里面
1
2 3 4 |
Application_Start(){
CreateRavenDBDocumentStore(); … } |
是否可以使用我的 global.asax.cs 文件中的此代码片段来创建将使用来自 MembershipProvider 的调用的文档存储?
希望我没有太困惑:)
谢谢
- 我认为使用 Raven 来获取会员数据根本不是一个好主意。在生产中 SQL 也有更好的信度和效度。
- 顺便说一句,已经有一些 RavenDB 会员提供程序,例如。在 GitHub 或 NuGet 上
- @RobertP 我比 Raven 更了解 Mongo,但是您应该使用多数写入来获得足够的一致性。我能想到的唯一真正的问题是,如果您没有粘性会话并且网络服务器以某种方式切换到辅助会话,则不会立即看到密码更改,但我希望这非常罕见,而且会员数据很少更改,您可以额外英里以确保它的书写一致。
- 我将 MongoDB 用于不稳定的不重要的事情,例如登陆页面上的顶级报价重定向。在这种情况下非常酷,超快。如果所有数据都无效或获得大量数据,也没有问题。
- 并且乌鸦也为 nservicebus saga 持久性。在第一个持久性问题之后,我切换到 SQL。
这是一个很好的项目,并写了将 ravendb 会员提供程序与 mvc 一起使用。你可以参考我在我的案例中使用的这个项目。
来源:https://www.codenong.com/16811078/