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

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.
 
C

Chad Scharf

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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,755
Messages
2,569,537
Members
45,023
Latest member
websitedesig25

Latest Threads

Top