10.3. Core Provider Classes

You have seen a number of the different support classes that are common to providers. In this section, you walk through each of the core classes so that you can see in one place the different provider-related classes.

10.3.1. System.Configuration.Provider Classes

The core provider classes that define the base functionality for a provider are found in the System.Configuration.Provider namespace. These classes are available for use both in ASP.NET and non-ASP.NET applications.

10.3.1.1. ProviderBase

Of course, the most important provider class is the base class from which most providers derive: System.Configuration.Provider.ProviderBase. The class signature is:

C#

public abstract class ProviderBase {

        public virtual string Name { get };
        public virtual string Description {get };

        public virtual void Initialize(string name, NameValueCollection config);
    }

VB.NET

Public MustInherit Class ProviderBase

    Public Overridable ReadOnly Property Description As String
    Public Overridable ReadOnly Property Name As String

    Public Overridable Sub Initialize( _
    ByVal name As String, _
    ByVal config As NameValueCollection)

End Class

Feature-specific provider definitions derive from ProviderBase, and as a developer you write custom providers that in turn derive from a feature's provider base class definition. It is unlikely that you would ever author a provider that directly derives from ProviderBase because ProviderBase exposes very little functionality.

ProviderBase is abstract ...

Get Professional ASP.NET 3.5 Security, Membership, and Role Management with C# and VB now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.