General rules for when to use which types of memberships in MVC

假装没事ソ 提交于 2019-12-08 13:46:43

问题


Already I have known 3 types of memberships in Microsoft MVC. They are:

  1. membershipprovider
  2. extendedmembershipprovider
  3. simplemembershipprovider

Obviously they have differences to use. What is the key advantage for selecting each of them? May somebody describe?

Thanks.


回答1:


The following post from Jon Galloway goes into great detail explaining what I think it is you are asking.

The article includes a class diagram that shows the relationship between all three classes that you have listed.

The relevant take-away quote is this one:

SimpleMembershipProvider is an implementaiton of an ExtendedMembershipProvider, which inherits from MembershipProvider and adds some other account / OAuth related things.

Be sure to look at the class diagram, it is in the section called How SimpleMembership integrates with ASP.NET Membership

Hope that helps.




回答2:


MembershipProvider is an abstract class that all other membership providers inherit from. You can't create an instance of it, because it's abstract.

There are other membership providers, such as SqlMembershipProvider, and the universal membership providers, that inherit from this as well, not to mention MySqlMembershipProvider, OracleMembershipProvider, etc.. etc.. etc..

Microsoft created a more simplified provider model, called the ExtendedMembershipProvider, which also inherits from MembershipProvider. Like MembershipProvider, ExtendedMembershipProvider is also abstract and cannot be instantiated. You need to inherit from it.

SimpleMembershipProvider inherits from ExendedMembershipProvider, and there may be others as well.



来源:https://stackoverflow.com/questions/18562758/general-rules-for-when-to-use-which-types-of-memberships-in-mvc

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!