【发布时间】:2013-05-29 10:09:42
【问题描述】:
我正在尝试实现使用 ravenDB 的 .net 会员提供程序。我已经在我的 mvc4 应用程序中设置了 raven db,并且我认为我设置了正确的成员资格提供程序以使用 ravenDB,除了从成员资格提供程序调用文档存储。我发现的示例使用以下
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 项目中设置了文档存储
public static IDocumentStore DocumentStore { get; private set; }
private static void CreateRavenDBDocumentStore()
{
DocumentStore = new DocumentStore
{
ConnectionStringName = "RavenDB"
}.Initialize();
}
里面
Application_Start(){
CreateRavenDBDocumentStore();
...
}
是否可以使用我的 global.asax.cs 文件中的此代码 sn-p 来创建将使用来自 MembershipProvider 的调用的文档存储?
希望我没有太困惑:)
谢谢
【问题讨论】:
-
我认为使用 Raven 来获取会员数据根本不是一个好主意。在生产环境中,SQL 也有更好的信度和效度。
-
@RobertP 我比 Raven 更了解 Mongo,但您应该使用多数写入来获得足够的一致性。我能想到的唯一真正的问题是,如果您没有粘性会话并且网络服务器以某种方式切换到辅助会话,则不会立即看到密码更改,但我希望这种情况非常罕见,而且会员数据很少更改,您可以去加倍努力以确保其编写一致。
-
我将 MongoDB 用于不稳定的不重要的事情,例如登陆页面上的顶级报价重定向。在这种情况下非常酷,超快。如果所有数据都无效或获得大量数据,也没有问题。
-
为了 nservicebus saga 的持久性,也乌鸦了。在第一个持久性问题后,我切换到 SQL。
标签: c# .net ravendb membership-provider