ChannelDispatcher.IsTransactedReceive 属性
定义
重要
一些信息与预发行产品相关,相应产品在发行之前可能会进行重大修改。 对于此处提供的信息,Microsoft 不作任何明示或暗示的担保。
获取一个值,该值指示对侦听程序的接收方法调用是否在事务中完成。
public:
property bool IsTransactedReceive { bool get(); void set(bool value); };
public bool IsTransactedReceive { get; set; }
member this.IsTransactedReceive : bool with get, set
Public Property IsTransactedReceive As Boolean
属性值
如果对侦听程序的接收方法调用是在事务中完成,则为 true
;否则为 false
。
例外
通信对象处于 Faulted 状态。
示例
Uri baseAddress = new Uri("http://localhost:8001/Simple");
ServiceHost serviceHost = new ServiceHost(typeof(CalculatorService), baseAddress);
serviceHost.AddServiceEndpoint(
typeof(ICalculator),
new WSHttpBinding(),
"CalculatorServiceObject");
serviceHost.Open();
IChannelListener icl = serviceHost.ChannelDispatchers[0].Listener;
ChannelDispatcher dispatcher = new ChannelDispatcher(icl);
bool isTransactedReceive = dispatcher.IsTransactedReceive;
Dim baseAddress As New Uri("http://localhost:8001/Simple")
Dim serviceHost As New ServiceHost(GetType(CalculatorService), baseAddress)
serviceHost.AddServiceEndpoint(GetType(ICalculator), New WSHttpBinding(), "CalculatorServiceObject")
serviceHost.Open()
Dim icl As IChannelListener = serviceHost.ChannelDispatchers(0).Listener
Dim dispatcher As New ChannelDispatcher(icl)
Dim isTransactedReceive As Boolean = dispatcher.IsTransactedReceive
注解
只有当 IsTransactedReceive 的实例处于 ChannelDispatcher 状态时才可以设置 Created 属性,因为该状态是唯一一个可变且不被释放的状态。