本文整理汇总了C#中NativeActivityContext.Track方法的典型用法代码示例。如果您正苦于以下问题:C# NativeActivityContext.Track方法的具体用法?C# NativeActivityContext.Track怎么用?C# NativeActivityContext.Track使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类NativeActivityContext
的用法示例。
在下文中一共展示了NativeActivityContext.Track方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Track
private void Track(NativeActivityContext context, Object data)
{
string source = this.Source.Get(context), target = this.Target.Get(context);
context.Track(new CustomTrackingRecord("FileCopy", System.Diagnostics.TraceLevel.Info)
{
Data = { { "Source", source }, { "Target", target }, { "Progress", data } }
});
}
示例2: LogBuildMessage
/// <summary>
/// Log a message to the build tracking participant.
/// </summary>
/// <param name="context">The current activity context.</param>
/// <param name="message">The message to log.</param>
/// <param name="importance">The importance level of the message.</param>
private static void LogBuildMessage(NativeActivityContext context, string message, BuildMessageImportance importance)
{
var record = new BuildInformationRecord<BuildMessage>
{
ParentToBuildDetail = false,
Value = new BuildMessage
{
Importance = importance,
Message = message
}
};
context.Track(record);
}
示例3: LogBuildError
/// <summary>
/// Log an error message to the build tracking participant.
/// </summary>
/// <param name="context">The current activity context.</param>
/// <param name="message">The message to log.</param>
private static void LogBuildError(NativeActivityContext context, string message)
{
var record = new BuildInformationRecord<BuildError>
{
ParentToBuildDetail = false,
Value = new BuildError
{
Message = message
}
};
context.Track(record);
}
示例4: OnBodyCompleted
/// <summary>
/// The on body completed.
/// </summary>
/// <param name="context">
/// The context.
/// </param>
/// <param name="completedinstance">
/// The completed instance.
/// </param>
/// <param name="result">
/// The result.
/// </param>
private void OnBodyCompleted(NativeActivityContext context, ActivityInstance completedinstance, object result)
{
this.noPersistHandle.Get(context).Exit(context);
// The body activities can create a response message or response may be data
// Create the response message
var response = result as HttpResponseMessage ?? new HttpResponseMessage();
// If the result was data, add it to the content
if (!(result is HttpResponseMessage) && result != null)
{
object content;
Type contentType;
if (result is IQueryable)
{
var listType = typeof(List<>).MakeGenericType(((IQueryable)result).ElementType);
content = (IList)Activator.CreateInstance(listType, result);
contentType = listType;
}
else
{
content = result;
contentType = result.GetType();
}
response.Content = new ObjectContent(
contentType, content, GetNegotiatedMediaType(this.receiveContext.Request));
}
WorkflowCookieCorrelation.AddCookie(response, context.WorkflowInstanceId);
this.receiveContext.Response = response;
context.Track(new HttpReceiveResponseRecord(result));
if (this.PersistBeforeSend)
{
context.ScheduleActivity(this.persist);
}
}
示例5: Execute
/// <summary>
/// The execute.
/// </summary>
/// <param name="context">
/// The context.
/// </param>
protected override void Execute(NativeActivityContext context)
{
this.hostContext = context.GetExtension<IHttpWorkflowHostContext>();
// Typically there is only one base address but there could be more than one.
foreach (var bookmarkName in this.hostContext.BaseAddresses.Select(this.GetBookmarkName))
{
context.CreateBookmark(bookmarkName, this.ReceiveCallback);
context.Track(new HttpReceiveMessageRecord(bookmarkName));
}
}
示例6: ProcessReceiveMessageTrace
void ProcessReceiveMessageTrace(NativeActivityContext executionContext, Guid receivedActivityId)
{
if (TraceUtility.MessageFlowTracing)
{
try
{
//
ReceiveMessageRecord messageFlowTrackingRecord = new ReceiveMessageRecord(MessagingActivityHelper.MessageCorrelationReceiveRecord)
{
E2EActivityId = receivedActivityId
};
executionContext.Track(messageFlowTrackingRecord);
if (receivedActivityId != Guid.Empty && DiagnosticTraceBase.ActivityId != receivedActivityId)
{
DiagnosticTraceBase.ActivityId = receivedActivityId;
}
FxTrace.Trace.SetAndTraceTransfer(executionContext.WorkflowInstanceId, true);
if (TraceUtility.ActivityTracing)
{
if (TD.StartSignpostEventIsEnabled())
{
TD.StartSignpostEvent(new DictionaryTraceRecord(new Dictionary<string, string>(3) {
{ MessagingActivityHelper.ActivityName, this.DisplayName },
{ MessagingActivityHelper.ActivityType, MessagingActivityHelper.MessagingActivityTypeActivityExecution },
{ MessagingActivityHelper.ActivityInstanceId, executionContext.ActivityInstanceId }
}));
}
}
else if (TD.WfMessageReceivedIsEnabled())
{
TD.WfMessageReceived(new EventTraceActivity(receivedActivityId), executionContext.WorkflowInstanceId);
}
}
catch (Exception ex)
{
if (Fx.IsFatal(ex))
{
throw;
}
FxTrace.Exception.AsInformation(ex);
}
}
}