ComMethodElement 类
定义
重要
一些信息与预发行产品相关,相应产品在发行之前可能会进行重大修改。 对于此处提供的信息,Microsoft 不作任何明示或暗示的担保。
表示在 COM+ 组件上的接口作为 Web 服务公开时公开的 COM+ 方法。 此类不能被继承。
public ref class ComMethodElement sealed : System::Configuration::ConfigurationElement
public sealed class ComMethodElement : System.Configuration.ConfigurationElement
type ComMethodElement = class
inherit ConfigurationElement
Public NotInheritable Class ComMethodElement
Inherits ConfigurationElement
- 继承
注解
COM+ 集成配置工具(ComSvcConfig.exe)可用于从 COM 接口添加特定方法,以显示在生成的服务协定上。
例如,可以使用以下命令将组件上的 COM 接口中的IFinancesItemOrders.Financial三个命名方法添加到生成的服务协定。
ComSvcConfig.exe /i /application:OnlineStore /contract:ItemOrders.Financial,IFinances.{TransferFunds,AddFunds,RemoveFunds} /hosting:complus
运行 ComSvcConfig.exe 时,它将生成以下服务协定,其中列出了前面提到的方法作为 exposedMethod 元素。
<comContract contractType="{C551FBA9-E3AA-4272-8C2A-84BD8D290AC7}" name="IFinances" namespace="http://contoso.com/services/financial">
<exposedMethod name="TransferFunds"/>
<exposedMethod name="AddFunds"/>
<exposedMethod name="RemoveFunds"/>
</comContract>
在服务初始化时,运行时会尝试通过反映并仅添加元素列表中 exposedMethod 包含的方法来生成服务协定。 为服务协定中不包含的每个接口方法生成跟踪。
构造函数
| 名称 | 说明 |
|---|---|
| ComMethodElement() |
初始化 ComMethodElement 类的新实例。 |
| ComMethodElement(String) |
使用指定的方法初始化类的新实例 ComMethodElement 。 |