Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/csharp/290.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/.net/20.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C# 使用ravenDB的成员资格提供程序_C#_.net_Ravendb_Membership Provider - Fatal编程技术网

C# 使用ravenDB的成员资格提供程序

C# 使用ravenDB的成员资格提供程序,c#,.net,ravendb,membership-provider,C#,.net,Ravendb,Membership Provider,我正在尝试实现使用ravenDB的.net成员资格提供程序。我已经在mvc4应用程序中设置了raven db,我想我已经正确地设置了raven db的成员资格提供程序,除了从成员资格提供程序调用文档存储之外。我发现的示例使用了以下内容 public IDocumentStore DocumentStore { get { if (documentStore == null)

我正在尝试实现使用ravenDB的.net成员资格提供程序。我已经在mvc4应用程序中设置了raven db,我想我已经正确地设置了raven db的成员资格提供程序,除了从成员资格提供程序调用文档存储之外。我发现的示例使用了以下内容

 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文件中的此代码段来创建文档存储,该文档存储将使用MembershipProvider的调用

希望我没有太困惑:)


谢谢

这是一个很好的项目,是关于如何将ravendb会员资格提供商与mvc结合使用的。你可以参考我在案例中使用的内容。

我认为使用Raven来存储会员资格数据根本不是一个好主意。在生产环境中,SQL也具有更好的可靠性和有效性。除此之外,还有一些RavenDB成员资格提供商已经存在,例如,@RobertP,我知道Mongo比Raven更好,但您应该使用多数写入来获得足够的一致性。我能想到的唯一真正的问题是,如果您没有粘性会话,并且web服务器以某种方式切换到第二个会话,那么密码更改不会立即反映出来,但我认为这是非常罕见的,而且会员数据很少被更改,你可以多花一点时间来确保它的编写一致性。我使用MongoDB来处理易变的不重要的事情,比如登录页面上的top offer重定目标。在这种情况下非常酷,速度非常快。如果所有的数据都是无效的或者得到了很多数据,那么就没有问题了。raven也支持nservicebus saga的持久性。在出现第一个persistence问题后,我转而使用SQL。