加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 编程开发 > asp.Net > 正文

asp.net-mvc – 支持RavenDB的MVC4的会员系统

发布时间:2020-12-15 22:39:52 所属栏目:asp.Net 来源:网络整理
导读:我创建了很多快速的“概念验证”MVC应用程序,我实际上发现,随着用户注册和运行,MVC4模板附带的SimpleMembership提供商非常方便. OAuth在几分钟之内. 但是…我已经开始使用RavenDb(在RavenHQ上为我的项目很多).所以,我开始尝试根据ExtendedMembershipProvider
我创建了很多快速的“概念验证”MVC应用程序,我实际上发现,随着用户注册和运行,MVC4模板附带的SimpleMembership提供商非常方便. OAuth在几分钟之内.

但是…我已经开始使用RavenDb(在RavenHQ上为我的项目很多).所以,我开始尝试根据ExtendedMembershipProvider实现我自己的“定制会员提供者”,而在这样做时,我意识到没有什么意义.
我后来偶然发现了两个有趣的项目,试图解决这个确切的问题:

> WorldDomination.Web.Auth:https://github.com/PureKrome/WorldDomination.Web.Authentication
> MemFlex:https://github.com/OdeToCode/Memflex

两者都是最近有意思的努力,并且想知道这些是否是目前唯一正在建造的.我基本上正在寻找nuget pkg,我可以放入一个MVC4应用程序,连接到我的RavenDb并完成.我愿意建立这个东西,但不想重复已经运行的任何努力.
谢谢!

解决方法

RavenDB有几个ASP.Net成员资格提供商.他们都不是官方的,他们都有略微不同的实现. Google为“ravendb会员提供商”,您会发现很多.

有一个很好的文章here比较其中一些与Raven自己的授权和身份验证包.

我同意你应该更容易地在各种MVC4模板上交换出Raven的SQL.但是,除了依赖成员资格提供商之外,他们也倾向于拥有旨在与实体框架一起工作的模型.如果你想从头开始用RavenDB编写示例模板,你可能会有一个非常不同的最终产品.

更新

我没有意识到你在谈论新的SimpleMembershipProvider.我不知道这是存在的.我发现Jon Galloway’s article详细描述 – 一个伟大的阅读.他指出了两个相关的要点.我引用:

Note that SimpleMembership still requires some flavor of SQL Server – it won’t work with MySQL,NoSQL databases,etc. You can take a look at the code in WebMatrix.WebData.dll using a tool like ILSpy if you’d like to see why – there are places where SQL Server specific SQL statements are being executed,especially when creating and initializing tables. It seems like you might be able to work with another database if you created the tables separately,but I haven’t tried it and it’s not supported at this point.

The important thing to take away here is that a SimpleMembershipProvider is a MembershipProvider,but a MembershipProvider is not a SimpleMembershipProvider.
This distinction is important in practice: you cannot use an existing MembershipProvider (including the Universal Providers found in System.Web.Providers) with an API that requires a SimpleMembershipProvider,including any of the calls in WebMatrix.WebData.WebSecurity or Microsoft.Web.WebPages.OAuth.OAuthWebSecurity.

我会收集,那么为RavenDB编写一个SimpleMembershipProvider是不可能的.

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读