/// <summary> /// Provides a human readable trace /// </summary> /// <param name="record"> /// The record. /// </param> /// <param name="option"> /// The tracking options to use, if not provided will use the TrackingRecordExtensions.Options value /// </param> /// <param name="source"> /// The source. /// </param> public static void Trace( this ReceiveMessageRecord record, TrackingOption option = TrackingOption.Default, int tabs = 0 ) { WorkflowTrace.Information(record.ToFormattedString(option, tabs)); }
/// <summary> /// The trace method. /// </summary> /// <param name="record"> /// The record to trace. /// </param> /// <param name="option"> /// The tracking options to use, if not provided will use the TrackingOptions.Default value /// </param> /// <param name="tabs"> the tabs /// The tabs. /// </param> public static void Trace( this WorkflowInstanceUnhandledExceptionRecord record, TrackingOption option = TrackingOption.Default, int tabs = 0) { WorkflowTrace.Information(record.ToFormattedString(option, tabs)); }
/// <summary>Change Image Tracke Mode.</summary> public void SetTrackingOption(TrackingOption trackingOption) { NativeAPI.TrackerManager_setTrackingOption((int)trackingOption); if (trackingOption == TrackingOption.MULTI_TRACKING) { AbstractARManager.Instance.SetWorldCenterMode(AbstractARManager.WorldCenterMode.CAMERA); } }
/// <summary> /// Gets the record number if the tracking options indicate it should be included /// </summary> /// <param name="record"> /// The record. /// </param> /// <param name="option"> /// The options. /// </param> /// <returns> /// A string with the record number if the TrackingOptions.RecordNumber flag is used, otherwise an empty string /// </returns> public static string GetRecordNumber(this TrackingRecord record, TrackingOption option = TrackingOption.Default) { var tsb = new TraceStringBuilder(); if (option.HasFlag(TrackingOption.RecordNumber)) { tsb.AppendFormat("{0}: ", record.RecordNumber); } return tsb.ToString(); }
/// <summary> /// Returns the record as a formatted string /// </summary> /// <param name="record"> /// The record to trace. /// </param> /// <param name="option"> /// The tracking options to use, if not provided will use the TrackingOptions.Default value /// </param> /// <param name="tabs"> /// the tabs The tabs. /// </param> /// <returns> /// The formatted tracking record /// </returns> public static string ToFormattedString( this FaultPropagationRecord record, TrackingOption option = TrackingOption.Default, int tabs = 0) { var tsb = new TraceStringBuilder(tabs); tsb.AppendFormat( "{0}Fault source {1}", record.GetRecordNumber(option), record.FaultSource.ToFormattedString()); TrackingRecordExtensions.AppendInstance( tsb, option, record.InstanceId, record.Annotations, record.EventTime); return tsb.ToString(); }
public Specification( Expression <Func <T, bool> > criteria = null, IEnumerable <Expression <Func <T, object> > > includes = null, IEnumerable <string> includesAsStrings = null, TrackingOption tracking = TrackingOption.WithTracking) { Criteria = criteria ?? (t => true); Includes = includes ?? Enumerable.Empty <Expression <Func <T, object> > >(); IncludesAsStrings = includesAsStrings ?? Enumerable.Empty <string>(); Tracking = tracking; }
/// <summary> /// Returns the record as a formatted string /// </summary> /// <param name="record"> /// The record to trace. /// </param> /// <param name="option"> /// The tracking options to use, if not provided will use the TrackingOptions.Default value /// </param> /// <param name="tabs"> the tabs /// The tabs. /// </param> /// <returns> /// The formatted tracking record /// </returns> public static string ToFormattedString( this SendMessageRecord record, TrackingOption option = TrackingOption.Default, int tabs = 0) { var tsb = new TraceStringBuilder(tabs); tsb.AppendFormat( "{0}Activity {1} sent message E2E Activity ID {3}", record.GetRecordNumber(option), record.Activity.ToFormattedString(), record.E2EActivityId); TrackingRecordExtensions.AppendInstance(tsb, option, record.InstanceId, record.Annotations, record.EventTime); return tsb.ToString(); }
/// <summary> /// Returns the record as a formatted string /// </summary> /// <param name="record"> /// The record to trace. /// </param> /// <param name="option"> /// The tracking options to use, if not provided will use the TrackingOptions.Default value /// </param> /// <param name="tabs"> the tabs /// The tabs. /// </param> /// <returns> /// The formatted tracking record /// </returns> public static string ToFormattedString( this WorkflowInstanceSuspendedRecord record, TrackingOption option = TrackingOption.Default, int tabs = 0) { var tsb = new TraceStringBuilder(tabs); tsb.AppendFormat( "{0}WorkflowInstance \"{1}\" Suspended Reason \"{2}\"", record.GetRecordNumber(option), record.ActivityDefinitionId, record.Reason); TrackingRecordExtensions.AppendInstance(tsb, option, record.InstanceId, record.Annotations, record.EventTime); return tsb.ToString(); }
/// <summary> /// Returns the record as a formatted string /// </summary> /// <param name="record"> /// The record to trace. /// </param> /// <param name="option"> /// The tracking options to use, if not provided will use the TrackingOptions.Default value /// </param> /// <param name="tabs"> /// the tabs /// </param> /// <returns> /// The formatted tracking record /// </returns> public static string ToFormattedString( this ActivityScheduledRecord record, TrackingOption option = TrackingOption.Default, int tabs = 0) { var tsb = new TraceStringBuilder(tabs); tsb.AppendFormat( "{0}{1} scheduled {2}", record.GetRecordNumber(option), record.Activity.ToFormattedString(), record.Child.ToFormattedString("child activity")); TrackingRecordExtensions.AppendInstance( tsb, option, record.InstanceId, record.Annotations, record.EventTime); return tsb.ToString(); }
/// <summary> /// Returns the record as a formatted string /// </summary> /// <param name="record"> /// The record to trace. /// </param> /// <param name="option"> /// The tracking options to use, if not provided will use the TrackingOptions.Default value /// </param> /// <returns> /// The formatted tracking record /// </returns> public static string ToFormattedString( this ReceiveMessageRecord record, TrackingOption option = TrackingOption.Default, int tabs = 0) { var sb = new TraceStringBuilder( tabs, "{0}Activity [{1}] \"{2}\" received Message ID {3}, E2E Activity ID {4}", record.GetRecordNumber(option), record.Activity != null ? record.Activity.Id : Constants.Null, record.Activity != null ? record.Activity.Name : Constants.Null, record.MessageId, record.E2EActivityId); TrackingRecordExtensions.AppendInstance(sb, option, record.InstanceId, record.Annotations, record.EventTime); return sb.ToString(); }
/// <summary> /// Returns the record as a formatted string /// </summary> /// <param name="record"> /// The record to trace. /// </param> /// <param name="option"> /// The tracking options to use, if not provided will use the TrackingOptions.Default value /// </param> /// <param name="tabs"> /// the tabs The tabs. /// </param> /// <returns> /// The formatted tracking record /// </returns> public static string ToFormattedString( this BookmarkResumptionRecord record, TrackingOption option = TrackingOption.Default, int tabs = 0) { var traceablePayload = record.Payload as ITraceable; var tsb = new TraceStringBuilder(tabs); tsb.AppendFormat( "{0}Bookmark \"{1}\" resumed with payload <{2}> owner {3}", record.GetRecordNumber(option), record.BookmarkName ?? Constants.Null, traceablePayload != null ? traceablePayload.ToFormattedString() : record.Payload ?? Constants.Null, record.Owner.ToFormattedString()); TrackingRecordExtensions.AppendInstance( tsb, option, record.InstanceId, record.Annotations, record.EventTime); return tsb.ToString(); }
/// <summary> /// Returns the record as a formatted string /// </summary> /// <param name="record"> /// The record to trace. /// </param> /// <param name="option"> /// The tracking options to use, if not provided will use the TrackingOptions.Default value /// </param> /// <param name="tabs"> the tabs /// The tabs. /// </param> /// <returns> /// The formatted tracking record /// </returns> public static string ToFormattedString( this CancelRequestedRecord record, TrackingOption option = TrackingOption.Default, int tabs = 0) { var owner = record.Activity == null ? "Host" : record.Activity.ToFormattedString(); var tsb = new TraceStringBuilder(tabs); tsb.AppendFormat( "{0}{1} requests cancel of activity [{2}] \"{3}\"", record.GetRecordNumber(option), owner, record.Child != null ? record.Child.Id : Constants.Null, record.Child != null ? record.Child.Name : Constants.Null); TrackingRecordExtensions.AppendInstance(tsb, option, record.InstanceId, record.Annotations, record.EventTime); return tsb.ToString(); }
/// <summary> /// Returns the record as a formatted string /// </summary> /// <param name="record"> /// The record to trace. /// </param> /// <param name="option"> /// The tracking options to use, if not provided will use the TrackingOptions.Default value /// </param> /// <param name="tabs"> the tabs /// The tabs /// </param> /// <returns> /// The formatted tracking record /// </returns> public static string ToFormattedString( this WorkflowInstanceUnhandledExceptionRecord record, TrackingOption option = TrackingOption.Default, int tabs = 0) { var tsb = new TraceStringBuilder(tabs); tsb.AppendFormat( "{0}WorkflowInstance \"{1}\" Unhandled Exception Source \"{2}\" Exception <{3}>", record.GetRecordNumber(option), record.ActivityDefinitionId, record.FaultSource.Name, record.UnhandledException); TrackingRecordExtensions.AppendInstance(tsb, option, record.InstanceId, record.Annotations, record.EventTime); return tsb.ToString(); }
/// <summary> /// Returns the record as a formatted string /// </summary> /// <param name="record"> /// The record to trace. /// </param> /// <param name="option"> /// The tracking options to use, if not provided will use the TrackingOptions.Default value /// </param> /// <param name="tabs"> the tabs /// The tabs. /// </param> /// <returns> /// The formatted tracking record /// </returns> public static string ToFormattedString( this CustomTrackingRecord record, TrackingOption option = TrackingOption.Default, int tabs = 0) { var tsb = new TraceStringBuilder(tabs); tsb.AppendFormat( "{0}CustomTrackingRecord [{1}] \"{2}\"", record.GetRecordNumber(option), record.Activity.GetId(), record.Name ?? Constants.Null); TrackingRecordExtensions.AppendInstance( tsb, option, instanceId: record.InstanceId, annotations: record.Annotations, arguments: null, variables: null, data: record.Data, eventTime: record.EventTime); return tsb.ToString(); }
/// <summary>Change Image Tracke Mode.</summary> public void SetTrackingOption(TrackingOption trackingOption) { if (trackingOption == TrackingOption.CLOUD_RECOGNITION_AUTO_DEACTIVATION || trackingOption == TrackingOption.CLOUD_RECOGNITION_AUTO_ACTIVATION) { if (trackingOption == TrackingOption.CLOUD_RECOGNITION_AUTO_DEACTIVATION) { cloudRecognitionController.SetAutoEnable(false); } else { cloudRecognitionController.SetAutoEnable(true); } } else { NativeAPI.maxst_TrackerManager_setTrackingOption((int)trackingOption); if (trackingOption == TrackingOption.MULTI_TRACKING) { AbstractARManager.Instance.SetWorldCenterMode(AbstractARManager.WorldCenterMode.CAMERA); } } }
/// <summary> /// Returns the record as a formatted string /// </summary> /// <param name="record"> /// The record to trace. /// </param> /// <param name="option"> /// The tracking options to use, if not provided will use the TrackingOptions.Default value /// </param> /// <param name="tabs"> the tabs /// The tabs. /// </param> /// <returns> /// The formatted tracking record /// </returns> public static string ToFormattedString( this StateMachineStateRecord record, TrackingOption option = TrackingOption.Default, int tabs = 0) { var tsb = new TraceStringBuilder(tabs); tsb.AppendFormat( "{0}StateMachineStateRecord [{1}] \"{2}\" CurrentStateMachine State <{3}>", record.GetRecordNumber(option), record.Activity.GetId(), record.StateMachineName ?? Constants.Null, record.StateName); TrackingRecordExtensions.AppendInstance( tsb, option, record.InstanceId, record.Annotations, null, null, record.Data, record.EventTime); return tsb.ToString(); }
/// <summary> /// Initializes a new instance of the <see cref="TraceTrackingParticipant"/> class. /// </summary> /// <param name="option"> /// The tracking options /// </param> public TraceTrackingParticipant(TrackingOption option) { this.option = option; }
/// <summary> /// Traces additional data about a tracking record /// </summary> /// <param name="tsb"> /// The string builder. /// </param> /// <param name="option"> /// A TrackingOptions value which specifies data to include in the trace /// </param> /// <param name="instanceId"> /// The instance ID of the tracking record /// </param> /// <param name="annotations"> /// The annotations dictionary /// </param> /// <param name="eventTime"> /// The event time /// </param> internal static void AppendInstance( TraceStringBuilder tsb, TrackingOption option, Guid instanceId, IDictionary<string, string> annotations, DateTime eventTime) { AppendInstance( tsb, option, instanceId, annotations, arguments: null, variables: null, data: null, eventTime: eventTime); }
/// <summary> /// Provides a human readable trace /// </summary> /// <param name="record"> /// The record. /// </param> /// <param name="option"> /// The tracking options to use, if not provided will use the TrackingOptions.Default value /// </param> /// <param name="tabs"> the tabs /// The tabs. /// </param> public static void Trace( this CancelRequestedRecord record, TrackingOption option = TrackingOption.Default, int tabs = 0) { WorkflowTrace.Information(record.ToFormattedString(option, tabs)); }
/// <summary> /// The anything to trace. /// </summary> /// <param name="option"> /// The options. /// </param> /// <param name="workflowTraceOptions"> /// The trace options /// </param> /// <param name="annotations"> /// The annotations. /// </param> /// <param name="arguments"> /// The arguments. /// </param> /// <param name="variables"> /// The variables. /// </param> /// <param name="data"> /// The data. /// </param> /// <returns> /// true if there is anything to trace. /// </returns> private static bool AnythingToTrace( TrackingOption option, WorkflowTraceOptions workflowTraceOptions, IDictionary<string, string> annotations, IDictionary<string, object> arguments, IDictionary<string, object> variables, IDictionary<string, object> data) { return option.HasFlag(TrackingOption.InstanceId) || option.HasFlag(TrackingOption.Time) || workflowTraceOptions.HasFlag(WorkflowTraceOptions.ShowEmptyCollections) || (option.HasFlag(TrackingOption.Annotations) && !annotations.IsNullOrEmpty()) || (option.HasFlag(TrackingOption.Arguments) && !arguments.IsNullOrEmpty()) || (option.HasFlag(TrackingOption.Variables) && !variables.IsNullOrEmpty()) || (option.HasFlag(TrackingOption.Data) && !data.IsNullOrEmpty()); }
/// <summary> /// Returns a formatted string /// </summary> /// <param name="option"> /// The tracking options /// </param> /// <param name="tabs"> /// The tabs. /// </param> /// <returns> /// The formatted string /// </returns> public string ToFormattedString(TrackingOption option = TrackingOption.Default, int tabs = 0) { FormatInvoked = true; return this.Value.ToString(CultureInfo.InvariantCulture); }
/// <summary> /// Trace your tracking record /// </summary> /// <param name="option"> /// The tracking options /// </param> /// <param name="source"> /// The trace source /// </param> public void Trace(TrackingOption option, TraceSource source) { WorkflowTrace.Information(((TrackingRecord)this).ToFormattedString(option)); }
public static IQueryable <T> WithTrackingOption <T>(this IQueryable <T> queryable, TrackingOption tracking) where T : class { return(tracking == TrackingOption.WithTracking ? queryable.AsTracking() : queryable.AsNoTracking()); }
/// <summary> /// Traces a tracking record /// </summary> /// <param name="record"> /// The record to trace /// </param> /// <param name="option"> /// The tracking options to use, if not provided will use the TrackingOptions.Default value /// </param> /// <param name="tabs"> /// the tabs The tabs. /// </param> /// <remarks> /// The default ToString() method of tracking records produces difficult to read text /// The extensions provide formatted indented text designed to make it more readable /// </remarks> /// <returns> /// The formatted string. /// </returns> public static string ToFormattedString( this TrackingRecord record, TrackingOption option = TrackingOption.Default, int tabs = 0) { if (option.HasFlag(TrackingOption.None)) { return record.ToString(); } var activityStateRecord = record as ActivityStateRecord; if (activityStateRecord != null) { return activityStateRecord.ToFormattedString(option, tabs); } var activityScheduledRecord = record as ActivityScheduledRecord; if (activityScheduledRecord != null) { return activityScheduledRecord.ToFormattedString(option, tabs); } var bookmarkResumptionRecord = record as BookmarkResumptionRecord; if (bookmarkResumptionRecord != null) { return bookmarkResumptionRecord.ToFormattedString(option, tabs); } var cancelRequestedRecord = record as CancelRequestedRecord; if (cancelRequestedRecord != null) { return cancelRequestedRecord.ToFormattedString(option, tabs); } #if NET401_OR_GREATER var stateMachineStateRecord = record as StateMachineStateRecord; if (stateMachineStateRecord != null) { return stateMachineStateRecord.ToFormattedString(option, tabs); } #endif var receiveMessageRecord = record as ReceiveMessageRecord; if (receiveMessageRecord != null) { return receiveMessageRecord.ToFormattedString(option, tabs); } var sendMessageRecord = record as SendMessageRecord; if (sendMessageRecord != null) { return sendMessageRecord.ToFormattedString(option, tabs); } var trackingTrace = record as ICustomTrackingTrace; if (trackingTrace != null) { return trackingTrace.ToFormattedString(option, tabs); } var customTrackingRecord = record as CustomTrackingRecord; if (customTrackingRecord != null) { return customTrackingRecord.ToFormattedString(option, tabs); } var faultPropagationRecord = record as FaultPropagationRecord; if (faultPropagationRecord != null) { return faultPropagationRecord.ToFormattedString(option, tabs); } var workflowInstanceAbortedRecord = record as WorkflowInstanceAbortedRecord; if (workflowInstanceAbortedRecord != null) { return workflowInstanceAbortedRecord.ToFormattedString(option, tabs); } var workflowInstanceSuspendedRecord = record as WorkflowInstanceSuspendedRecord; if (workflowInstanceSuspendedRecord != null) { return workflowInstanceSuspendedRecord.ToFormattedString(option, tabs); } var workflowInstanceTerminatedRecord = record as WorkflowInstanceTerminatedRecord; if (workflowInstanceTerminatedRecord != null) { return workflowInstanceTerminatedRecord.ToFormattedString(option, tabs); } var workflowInstanceUnhandledExceptionRecord = record as WorkflowInstanceUnhandledExceptionRecord; if (workflowInstanceUnhandledExceptionRecord != null) { return workflowInstanceUnhandledExceptionRecord.ToFormattedString(option, tabs); } var workflowInstanceRecord = record as WorkflowInstanceRecord; if (workflowInstanceRecord != null) { return workflowInstanceRecord.ToFormattedString(option, tabs); } return record.ToString(); }
public async Task <IEnumerable <T> > GetAll(TrackingOption tracking = TrackingOption.WithTracking) { return(await DbContext.Set <T>().WithTrackingOption(tracking).ToListAsync()); }
public IEnumerable <T> GetAll(TrackingOption tracking = TrackingOption.WithTracking) { return(DbContext.Set <T>().WithTrackingOption(tracking).AsEnumerable()); }
/// <summary> /// Provides a human readable trace /// </summary> /// <param name="record"> /// The record. /// </param> /// <param name="option"> /// The tracking options to use, if not provided will use the TrackingOptions.Default value /// </param> /// <param name="tabs"> /// the tabs The tabs. /// </param> public static void Trace( this BookmarkResumptionRecord record, TrackingOption option = TrackingOption.Default, int tabs = 0) { WorkflowTrace.Information(record.ToFormattedString(option, tabs)); }
/// <summary> /// Traces additional data about a tracking record /// </summary> /// <param name="tsb"> /// The stringBuilder. /// </param> /// <param name="option"> /// A TrackingOptions value which specifies data to include in the trace /// </param> /// <param name="instanceId"> /// The instance ID of the tracking record /// </param> /// <param name="annotations"> /// The annotations dictionary /// </param> /// <param name="arguments"> /// The arguments dictionary /// </param> /// <param name="variables"> /// The variables dictionary /// </param> /// <param name="data"> /// The data dictionary /// </param> /// <param name="eventTime"> /// The event time /// </param> internal static void AppendInstance( TraceStringBuilder tsb, TrackingOption option, Guid instanceId, IDictionary<string, string> annotations, IDictionary<string, object> arguments, IDictionary<string, object> variables, IDictionary<string, object> data, DateTime eventTime) { if (!AnythingToTrace(option, tsb.Options, annotations, arguments, variables, data)) { return; } tsb.AppendLine(); using (tsb.IndentBlock()) { if (option.HasFlag(TrackingOption.InstanceId)) { tsb.AppendProperty("InstanceId", instanceId); } if (option.HasFlag(TrackingOption.Time)) { tsb.AppendProperty("Event Time", eventTime.ToString(EventTimeFormat)); } if (option.HasFlag(TrackingOption.Annotations)) { tsb.AppendDictionary("Annotations", annotations); } if (option.HasFlag(TrackingOption.Arguments)) { tsb.AppendDictionary("Arguments", arguments); } if (option.HasFlag(TrackingOption.Variables)) { tsb.AppendDictionary("Variables", variables); } if (option.HasFlag(TrackingOption.Data)) { tsb.AppendDictionary("Data", data); } } }
public static async Task <T> GetByIdAndInclude <T>(this IAsyncRepository <T> repository, int id, Expression <Func <T, object> > include, TrackingOption tracking = TrackingOption.WithTracking) where T : Entity { return((await repository.GetAll(new Specification <T>( t => t.Id == id, new[] { include }, null, tracking ))) .FirstOrDefault()); }
/// <summary> /// Provides a human readable trace /// </summary> /// <param name="record"> /// The record. /// </param> /// <param name="option"> /// The tracking options to use, if not provided will use the TrackingOptions.Default value /// </param> /// <param name="tabs"> /// the tabs /// </param> public static void Trace( this ActivityScheduledRecord record, TrackingOption option = TrackingOption.Default, int tabs = 0) { WorkflowTrace.Information(record.ToFormattedString(option, tabs)); }
/// <summary> /// Traces a tracking record /// </summary> /// <param name="record"> /// The record to trace /// </param> /// <param name="option"> /// The tracking options to use, if not provided will use the TrackingOptions.Default value /// </param> /// <param name="tabs"> /// the tabs The tabs. /// </param> /// <remarks> /// The default ToString() method of tracking records produces difficult to read text /// The extensions provide formatted indented text designed to make it more readable /// </remarks> public static void Trace( this TrackingRecord record, TrackingOption option = TrackingOption.Default, int tabs = 0) { WorkflowTrace.Information(record.ToFormattedString()); }