ModuleProvider.GetModuleDefinition(IManagementContext) 方法
定义
重要
一些信息与预发行产品相关,相应产品在发行之前可能会进行重大修改。 对于此处提供的信息,Microsoft 不作任何明示或暗示的担保。
在派生类中重写时,检索与模块提供程序关联的管理模块的相关信息。
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
参数
- context
- IManagementContext
一个 IManagementContext ,表示调用主机的管理上下文。
返回
与 ModuleDefinition 提供程序关联的 对象。
示例
以下示例演示如何重写 GetModuleDefinition 方法以返回模块定义。
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;
}
注解
如果未启用模块,则返回值应为 null
。
提供的上下文可用于确定是否应启用模块。
在激活新连接期间,每个连接调用此方法一次。