The provider model is a
design pattern
A design pattern is the re-usable form of a solution to a design problem. The idea was introduced by the architect Christopher Alexander and has been adapted for various other disciplines, particularly software engineering. The " Gang of Four" b ...
formulated by
Microsoft
Microsoft Corporation is an American multinational corporation, multinational technology company, technology corporation producing Software, computer software, consumer electronics, personal computers, and related services headquartered at th ...
for use in the ASP.NET Starter Kits and formalized in .NET version 2.0. It is used to allow an application to choose from one of multiple implementations or "condiments" in the application configuration, for example, to provide access to different data stores to retrieve login information, or to use different storage methodologies such as a database, binary to disk, XML, etc.
The .NET extensible provider model allows a "component" to have multiple implementations using an
abstract factory pattern
The abstract factory pattern provides a way to encapsulate a group of individual factories that have a common theme without specifying their concrete classes. In normal usage, the client software creates a concrete implementation of the abstract fa ...
approach. Providers are a subclass of the ProviderBase class and typically instantiated using a
factory method.
The provider model in ASP.NET 2.0 provides extensibility points for developers to plug their own implementation of a feature into the runtime. Both the membership and role features in ASP.NET 2.0 follow the provider pattern by specifying an interface, or contract. The provider model begins with the abstract class
ProviderBase
.
ProviderBase
exists to enforce the contract that all providers need public Name and Description properties, as well as a public Initialize method. Inheriting from
ProviderBase
are the
MembershipProvider
and
RoleProvider
abstract classes. These classes add additional properties and methods to define the interface for their specific areas of functionality.
Strategy pattern renaming
It has been argued that the provider model is merely another name for the already existing
strategy pattern
In computer programming, the strategy pattern (also known as the policy pattern) is a behavioral software design pattern that enables selecting an algorithm at runtime. Instead of implementing a single algorithm directly, code receives run-time ...
, and that this should, therefore, be the preferred terminology for describing the design pattern at hand.
See also
*
Strategy pattern
In computer programming, the strategy pattern (also known as the policy pattern) is a behavioral software design pattern that enables selecting an algorithm at runtime. Instead of implementing a single algorithm directly, code receives run-time ...
References
External links
MSDN: Provider Model Design Pattern and SpecificationProviderBase class documentation on MSDN
Software design patterns
.NET terminology
{{soft-eng-stub