I’m a little confused. In many tutorials, including some in MSDN and ASP.NET website, it’s almost always about Membership. But when examining the AccountModel class that’s created by default, it’s about an objet called _provider of type MembershipProvider.
First, I wonder why they just don’t use Membership instead of MembershipProvider?
secondly (and most irritating), why when I try to use _provider.GetAllUsers(), I’m asked to provide also parameters stuff such as pageindex, pagesize, etc. But, when I use Membership.GetAllUsers(), I don’t have to supply anything.
What the point of having both Membership and MembershipProvider with slightly different methods?
EDIT
Those are some of the documents I have used to learn how to use Membership. I’m talking about my books.
Thanks for helping
MembershipProvideris an abstract class, meaning you can’t create a new instance of it, rather, you must create your own custom class that inherits from it and then implement the functions.Having a base class as a constructor means you can pass in any class that inherits from it. As others have said, this helps when you’re testing. You can pass in a fake implementation or a mock of
MembershipProviderto test all the functionality of your controller/class.