ModuleProvider.GetModuleDefinition(IManagementContext) Method

Definition

When overridden in a derived class, retrieves the information about the management module that is associated with the module provider.

public:
 abstract Microsoft::Web::Management::Server::ModuleDefinition ^ GetModuleDefinition(Microsoft::Web::Management::Server::IManagementContext ^ context);
public abstract Microsoft.Web.Management.Server.ModuleDefinition GetModuleDefinition (Microsoft.Web.Management.Server.IManagementContext context);
abstract member GetModuleDefinition : Microsoft.Web.Management.Server.IManagementContext -> Microsoft.Web.Management.Server.ModuleDefinition
Public MustOverride Function GetModuleDefinition (context As IManagementContext) As ModuleDefinition

Parameters

context
IManagementContext

An IManagementContext that represents the calling host's management context.

Returns

The ModuleDefinition object that is associated with the provider.

Examples

The following example shows how to override the GetModuleDefinition method to return a module definition.

public override ModuleDefinition GetModuleDefinition(IManagementContext context) {


    if (context.User.Identity.IsAuthenticated != true)
        return null;

    string sModuleProviderName = this.Name;
    string sAssemblyQualifiedName = typeof(DemoModule).AssemblyQualifiedName;
    Trace.WriteLine(" ModuleProviderName : " + sModuleProviderName);
    Trace.WriteLine(" AssemblyQualifiedName : " + sAssemblyQualifiedName);

    ModuleDefinition modDefn = new ModuleDefinition(sModuleProviderName, sAssemblyQualifiedName);
    traceModDefn(modDefn);
    return modDefn;

}

Remarks

If the module is not enabled, the return value should be null.

The supplied context can be used to determine whether the module should be enabled.

This method is called once per connection, during the activation of a new connection.

Applies to