private static void TraceContext(this ITracingService tracingservice, IPluginExecutionContext plugincontext, bool parentcontext, bool attributetypes, bool convertqueries, IOrganizationService service, int depth) { if (plugincontext.Stage != 30) { tracingservice.Trace("--- Context {0} Trace Start ---", depth); tracingservice.Trace("Message : {0}", plugincontext.MessageName); tracingservice.Trace("Stage : {0}", plugincontext.Stage); tracingservice.Trace("Mode : {0}", plugincontext.Mode); tracingservice.Trace("Depth : {0}", plugincontext.Depth); tracingservice.Trace("Entity : {0}", plugincontext.PrimaryEntityName); if (!plugincontext.PrimaryEntityId.Equals(Guid.Empty)) { tracingservice.Trace("Id : {0}", plugincontext.PrimaryEntityId); } tracingservice.Trace(""); tracingservice.TraceAndAlign("InputParameters", plugincontext.InputParameters, attributetypes, convertqueries, service); tracingservice.TraceAndAlign("OutputParameters", plugincontext.OutputParameters, attributetypes, convertqueries, service); tracingservice.TraceAndAlign("SharedVariables", plugincontext.SharedVariables, attributetypes, convertqueries, service); tracingservice.TraceAndAlign("PreEntityImages", plugincontext.PreEntityImages, attributetypes, convertqueries, service); tracingservice.TraceAndAlign("PostEntityImages", plugincontext.PostEntityImages, attributetypes, convertqueries, service); tracingservice.Trace("--- Context {0} Trace End ---", depth); } if (parentcontext && plugincontext.ParentContext != null) { tracingservice.TraceContext(plugincontext.ParentContext, parentcontext, attributetypes, convertqueries, service, depth + 1); } tracingservice.Trace(""); }