Membership or Role Provider // Provider Model // Factories .. How does MS do it?

  • Thread starter Thread starter sloan
  • Start date Start date
S

sloan

Ok , first , I'm famaliar with both Providers.

And the "Factory Design Pattern".

Basically, if you don't override the default setting via config, you get the
default SqlRoleProvider or SqlMembershipProvider.

My question is....... how does MS check to see if you're using a different
provider.

Do they run an Xpath against the web.config to see if it exists?

.........


I'm more interested in the "They provide a default implementation, but I
gotta check to see if the default has been overwritten.
 
MS uses reflection against the TypeName you provide for the provider
(whichever one it is) in that provider's configuration, so if you were using
a custom MembershipProvider called MyStupendousMembershipProvider, you would
specify that type name and assembly in the config settings and microsoft
would pick that up via reflection and make its interface calls via the
factory pattern to your custom type.

As far as the default implementation goes, if no configuration exists, then
the base type is used which is the type provided in the framework as the
default that has to be overridden in the configuration if you want to use it
and have your own settings for it which is why you have to "Remove" it and
then "Add" it again in the config file with your own setting for a custom
configuration of the default framework provider, whichever it may be.
 
Back
Top