当前位置: 首页>>代码示例>>C#>>正文


C# NativeActivityContext.Track方法代码示例

本文整理汇总了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 } }
     });
 }
开发者ID:miguelhasse,项目名称:Workflow-Activities,代码行数:8,代码来源:FileCopy.cs

示例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);
 }
开发者ID:modulexcite,项目名称:CustomActivities,代码行数:19,代码来源:AzureAsyncOperation.cs

示例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);
 }
开发者ID:modulexcite,项目名称:CustomActivities,代码行数:17,代码来源:AzureAsyncOperation.cs

示例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);
            }
        }
开发者ID:IcodeNet,项目名称:cleansolution,代码行数:52,代码来源:HttpReceive.cs

示例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));
            }
        }
开发者ID:IcodeNet,项目名称:cleansolution,代码行数:17,代码来源:HttpReceive.cs

示例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);
                }
            }
        }
开发者ID:nlh774,项目名称:DotNetReferenceSource,代码行数:46,代码来源:InternalReceiveMessage.cs


注:本文中的NativeActivityContext.Track方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。