ProviderBase Class (System.Configuration.Provider)

Switch View :
ScriptFree
.NET Framework Class Library
ProviderBase Class

Provides a base implementation for the extensible provider model.

Inheritance Hierarchy

System.Object
  System.Configuration.Provider.ProviderBase
    System.Configuration.ProtectedConfigurationProvider
    System.Configuration.SettingsProvider
    System.Web.Caching.OutputCacheProvider
    System.Web.Management.WebEventProvider
    System.Web.Security.MembershipProvider
    System.Web.Security.RoleProvider
    System.Web.SessionState.SessionStateStoreProviderBase
    System.Web.SiteMapProvider
    System.Web.UI.WebControls.WebParts.PersonalizationProvider

Namespace:  System.Configuration.Provider
Assembly:  System.Configuration (in System.Configuration.dll)
Syntax

Visual Basic
Public MustInherit Class ProviderBase
C#
public abstract class ProviderBase
Visual C++
public ref class ProviderBase abstract
F#
[<AbstractClass>]
type ProviderBase =  class end

The ProviderBase type exposes the following members.

Constructors

  Name Description
Protected method ProviderBase Initializes a new instance of the ProviderBase class.
Top
Properties

  Name Description
Public property Description Gets a brief, friendly description suitable for display in administrative tools or other user interfaces (UIs).
Public property Name Gets the friendly name used to refer to the provider during configuration.
Top
Methods

  Name Description
Public method Equals(Object) Determines whether the specified Object is equal to the current Object. (Inherited from Object.)
Protected method Finalize Allows an object to try to free resources and perform other cleanup operations before it is reclaimed by garbage collection. (Inherited from Object.)
Public method GetHashCode Serves as a hash function for a particular type. (Inherited from Object.)
Public method GetType Gets the Type of the current instance. (Inherited from Object.)
Public method Initialize Initializes the provider.
Protected method MemberwiseClone Creates a shallow copy of the current Object. (Inherited from Object.)
Public method ToString Returns a string that represents the current object. (Inherited from Object.)
Top
Remarks

The provider model is intended to encapsulate all or part of the functionality of multiple ASP.NET features, such as membership, profiles, and protected configuration. It allows the developer to create supporting classes that provide multiple implementations of the encapsulated functionality. In addition, developers can write new features using the provider model. This can be an effective way to support multiple implementations of a feature's functionality without duplicating the feature code or recoding the application layer if the implementation method needs to be changed.

The ProviderBase class is simple, containing only a few basic methods and properties that are common to all providers. Feature-specific providers (such as MembershipProvider) inherit from ProviderBase and establish the necessary methods and properties that the implementation-specific providers for that feature must support. Implementation-specific providers (such as SqlMembershipProvider) inherit in turn from a feature-specific provider (in this case, MembershipProvider).

The most important aspect of the provider model is that the implementation (for example, whether data is persisted as a text file or in a database) is abstracted from the application code. The type of the implementation-specific provider for the given feature is designated in a configuration file. The feature-level provider then reads in the type from the configuration file and acts as a factory to the feature code. The application developer can then use the feature classes in the application code. The implementation type can be swapped out in the configuration file, eliminating the need to rewrite the code to accommodate the different implementation methodology.

The providers included with ASP.NET are mostly abstractions of data persistence implementations for features like profiles or membership. However, this model can be applied to any other kind of feature functionality that could be abstracted and implemented in multiple ways.

Examples

For an example of how to use the ProviderBase class, see Profile Provider Implementation Example.

Version Information

.NET Framework

Supported in: 4, 3.5, 3.0, 2.0

.NET Framework Client Profile

Supported in: 4, 3.5 SP1
Platforms

Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows XP SP2 x64 Edition, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2

The .NET Framework does not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.
Thread Safety

Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.
See Also

Reference

Other Resources