本文整理汇总了C#中Worker.WorkSend方法的典型用法代码示例。如果您正苦于以下问题:C# Worker.WorkSend方法的具体用法?C# Worker.WorkSend怎么用?C# Worker.WorkSend使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Worker
的用法示例。
在下文中一共展示了Worker.WorkSend方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Send
/// <summary>
/// Send a response back to the remote endpoint.
/// </summary>
/// <param name="data">The data to send back.</param>
/// <param name="correlate">The result to correlate this response with.</param>
/// <returns>A send result structure that details the result of the send operation.</returns>
public ISendResult Send(MARC.Everest.Interfaces.IGraphable data, IReceiveResult correlate)
{
if (!IsOpen())
throw new ConnectorException(ConnectorException.MSG_INVALID_STATE, ConnectorException.ReasonType.NotOpen);
Worker w = new Worker();
var cresult = correlate as WcfReceiveResult;
w.MessageId = cresult.MessageIdentifier;
w.MessageVersion = cresult.MessageVersion; // Prepare
w.Formatter = (IXmlStructureFormatter)Formatter;
w.ResponseHeaders = cresult.ResponseHeaders;
w.InvalidResponse = InvalidResponse;
w.WorkSend(data); // Work
// Publish so WCF connector can send a result
lock (results)
results.Add(w.MessageId, w.SendResult);
// Notify
PublishResult(w.MessageId);
// Return result
return w.SendResult;
}
示例2: Send
/// <summary>
/// Send a request to the remote endpoint with the specified message headers
/// </summary>
/// <param name="data">The data to be sent to the remote endpoint</param>
/// <param name="headers">The SOAP headers to append to the request</param>
/// <returns>A <see cref="T:MARC.Everest.Connectors.WCF.WcfSendResult"/> instance containing the result of the send operation</returns>
public ISendResult Send(MARC.Everest.Interfaces.IGraphable data, MessageHeaders headers)
{
//TODO: Convert this into a method call for reuability.
// Formatter check
if (!IsOpen())
throw new ConnectorException(ConnectorException.MSG_INVALID_STATE, ConnectorException.ReasonType.NotOpen);
// Create the work that will perform the operations
Worker w = new Worker();
w.Formatter = (IXmlStructureFormatter)Formatter;
#if WINDOWS_PHONE
w.Actions = this.m_actions;
#else
w.WcfConfiguration = wcfConfiguration;
#endif
w.MessageVersion = wcfClient.Endpoint.Binding.MessageVersion;
w.CustomHeaders = headers;
// Work
w.WorkSend(data);
// Send over the channel
if (w.SendResult.Code == ResultCode.Accepted ||
w.SendResult.Code == ResultCode.AcceptedNonConformant)
lock (results)
results.Add(w.SendResult, wcfClient.ProcessInboundMessage(w.SendResult.Message));
// Return the result
return w.SendResult;
}