コード例 #1
0
        public static void DebugContext(this ITracingService tracingService, IExecutionContext context)
        {
#if DEBUG
            var json = Debug.DebugContext(context);
            tracingService.LogMessage(json);
#endif
        }
コード例 #2
0
        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
        }
コード例 #3
0
        public static void DebugMessage(this ITracingService tracingService, string message)
        {
#if DEBUG
            tracingService.LogMessage(message);
#endif
        }
コード例 #4
0
        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
        }
コード例 #5
0
        public static void DebugMessage(this ITracingService tracingService, string format, params object[] args)
        {
#if DEBUG
            tracingService.LogMessage(format, args);
#endif
        }