Share via


IProviderConfigurationService.ConfigureProvider(ProviderFeature) Method

Definition

Configures the settings for the ASP.NET membership provider.

public:
 bool ConfigureProvider(Microsoft::Web::Management::Client::Extensions::ProviderFeature ^ feature);
public bool ConfigureProvider (Microsoft.Web.Management.Client.Extensions.ProviderFeature feature);
abstract member ConfigureProvider : Microsoft.Web.Management.Client.Extensions.ProviderFeature -> bool
Public Function ConfigureProvider (feature As ProviderFeature) As Boolean

Parameters

feature
ProviderFeature

The ASP.NET membership provider that implements the custom configuration.

Returns

true if configuration was successful; otherwise, false.

Examples

The following example configures the provider when the page changes.

private void OnWorkerDoWork(object sender, DoWorkEventArgs e) {
    if (_hasChanges) {
        _providerConfigurationService.ConfigureProvider(
            new MyProviderConfigurationFeature(
            _MyPage, (string)_MyComboBox.SelectedItem
            ));
    }
} 

using System;
using System.ComponentModel;
using System.Diagnostics;
using Microsoft.Web.Management.Client;
using Microsoft.Web.Management.Client.Extensions;
using Microsoft.Web.Management.Server;
using System.Collections;
using System.Collections.Generic;


public class MyProviderConfigurationFeature : ProviderFeature {

    private MySettingsPage _owner;
    private string _selectedProvider;
    private Module _module;

    public MyProviderConfigurationFeature() {
    }

    internal MyProviderConfigurationFeature(Module module) {
        _module = module;
    }

    internal MyProviderConfigurationFeature(MySettingsPage owner) {
        _owner = owner;
    }

    internal MyProviderConfigurationFeature(
        MySettingsPage owner, string selectedProvider) {
        _owner = owner;
        _selectedProvider = selectedProvider;
    }

    public override string ConnectionStringAttributeName {
        get {
            return "connectionStringName";
        }
    }

    public override bool ConnectionStringRequired {
        get {
            return true;
        }
    }

    public override string FeatureName {
        get {
            return "My cool Feature";
        }
    }

    public override string ProviderBaseType {
        get {
            return "Me.My.MyProvider";
        }
    }

    public override string ProviderCollectionPropertyName {
        get {
            return "providers";
        }
    }

    public override string[] ProviderConfigurationSettingNames {
        get {
            return new string[] {"appName", 
                                         "description", 
                                         "connectionStringName"};
        }
    }

    public override string SectionName {
        get {
            return "system.web/My";
        }
    }

    public override string SelectedProvider {
        get {
            if (_selectedProvider == null) {
                return String.Empty;
            }

            return _selectedProvider;
        }
    }

    public override string SelectedProviderPropertyName {
        get {
            return "defaultProvider";
        }
    }

    public override ProviderConfigurationSettings Settings {
        get {
            return new MyProviderConfigurationSettings(_module);
        }
    }
} 

Applies to