public static void DebugContext(this ITracingService tracingService, IExecutionContext context) { #if DEBUG var json = Debug.DebugContext(context); tracingService.LogMessage(json); #endif }
public static void DebugContext(this ITracingService tracingService, IPluginExecutionContext context) { var preEntityImages = context.PreEntityImages == null ? null : context.PreEntityImages.Values.Select(x => EntityToObject(x)); var postEntityImages = context.PostEntityImages == null ? null : context.PostEntityImages.Values.Select(x => EntityToObject(x)); var inputParameters = new Dictionary<string, object>(); foreach(var key in context.InputParameters.Keys) { if (context.InputParameters[key] is Entity x) { inputParameters.Add(key, EntityToObject(x)); } else { inputParameters.Add(key, context.InputParameters[key]); } } var outputParameters = new Dictionary<string, object>(); foreach (var key in context.OutputParameters.Keys) { if (context.OutputParameters[key] is Entity x) { outputParameters.Add(key, EntityToObject(x)); } else { outputParameters.Add(key, context.OutputParameters[key]); } } var obj = new { context.BusinessUnitId, context.CorrelationId, context.Depth, context.InitiatingUserId, context.IsExecutingOffline, context.IsInTransaction, context.IsOfflinePlayback, context.IsolationMode, context.MessageName, context.Mode, context.OperationCreatedOn, context.OperationId, context.OrganizationId, context.OrganizationName, context.OwningExtension, context.PrimaryEntityId, context.PrimaryEntityName, context.RequestId, context.SecondaryEntityName, context.SharedVariables, context.Stage, context.UserId, InputParameters = inputParameters, OutputParameters = outputParameters, PostEntityImages = postEntityImages, PreEntityImages = preEntityImages, //IsAutoTransact = context.IsAutoTransact(), //IsWithinMainTransaction = context.IsWithinMainTransaction() }; tracingService.LogMessage(SimpleJson.SerializeObject(obj)); #endif }
public static void DebugMessage(this ITracingService tracingService, string message) { #if DEBUG tracingService.LogMessage(message); #endif }
public static void DebugContext(this ITracingService tracingService, IExecutionContext context) { #if DEBUG try { var preEntityImages = new Dictionary <string, object>(); foreach (var key in context?.PreEntityImages?.Keys) { preEntityImages.Add(key, EntityToObject(context?.PreEntityImages?[key])); } var postEntityImages = new Dictionary <string, object>(); foreach (var key in context?.PostEntityImages?.Keys) { postEntityImages.Add(key, EntityToObject(context?.PostEntityImages?[key])); } var inputParameters = new Dictionary <string, object>(); foreach (var key in context?.InputParameters?.Keys) { if (context?.InputParameters?[key] is Entity x) { inputParameters.Add(key, EntityToObject(x)); } else { inputParameters.Add(key, context?.InputParameters?[key]); } } var outputParameters = new Dictionary <string, object>(); foreach (var key in context?.OutputParameters?.Keys) { if (context?.OutputParameters?[key] is Entity x) { outputParameters.Add(key, EntityToObject(x)); } else { outputParameters.Add(key, context?.OutputParameters?[key]); } } var obj = new { context?.BusinessUnitId, context?.CorrelationId, context?.Depth, context?.InitiatingUserId, context?.IsExecutingOffline, context?.IsInTransaction, context?.IsOfflinePlayback, context?.IsolationMode, context?.MessageName, context?.Mode, context?.OperationCreatedOn, context?.OperationId, context?.OrganizationId, context?.OrganizationName, context?.OwningExtension, context?.PrimaryEntityId, context?.PrimaryEntityName, context?.RequestId, context?.SecondaryEntityName, context?.SharedVariables, context?.UserId, InputParameters = inputParameters, OutputParameters = outputParameters, PostEntityImages = postEntityImages, PreEntityImages = preEntityImages, }; tracingService.LogMessage(SimpleJson.SerializeObject(obj)); } catch { } #endif }
public static void DebugMessage(this ITracingService tracingService, string format, params object[] args) { #if DEBUG tracingService.LogMessage(format, args); #endif }