public override void Execute() { Trace(string.Format(CultureInfo.InvariantCulture, TraceMessageHelper.EnteredMethod, SystemTypeName, MethodBase.GetCurrentMethod().Name)); using (OrganizationServiceContext = OrganizationServiceContext ?? new CrmServiceContext(OrganizationService)) using (CrmService = CrmService ?? new CrmService(OrganizationServiceContext, TracingService)) using (InitializeEntityService = InitializeEntityService ?? new InitializeEntityService(CrmService, OrganizationServiceContext, WorkflowContext, TracingService)) { Trace(string.Format(CultureInfo.InvariantCulture, "{0} : {1} started at {2} milliseconds", SystemTypeName, MethodBase.GetCurrentMethod().Name, Stopwatch.ElapsedMilliseconds)); // Call the business logic InitializedEntity output = InitializeEntityService.InitializeEntity( BusinessEntityPrimaryKey.Get <string>(CodeActivityContext) ); // Serialize the output in JSON data format string json = SerializationHelper.SerializeJson(output); // Return the JSON data to the caller InitializedEntity.Set(CodeActivityContext, json); Trace(string.Format(CultureInfo.InvariantCulture, "{0} : {1} ended at {2} milliseconds", SystemTypeName, MethodBase.GetCurrentMethod().Name, Stopwatch.ElapsedMilliseconds)); } Trace(string.Format(CultureInfo.InvariantCulture, TraceMessageHelper.ExitingMethod, SystemTypeName, MethodBase.GetCurrentMethod().Name)); }
/// <summary> /// Executes the business logic. /// </summary> public override void Execute() { Trace(string.Format(CultureInfo.InvariantCulture, TraceMessageHelper.EnteredMethod, UnderlyingSystemTypeName, MethodBase.GetCurrentMethod().Name)); using (OrganizationServiceContext = OrganizationServiceContext ?? new CrmServiceContext(OrganizationService)) using (CrmService = CrmService ?? new CrmService(OrganizationServiceContext, TracingService)) using (InitializeEntityService = InitializeEntityService ?? new InitializeEntityService(CrmService, OrganizationServiceContext, PluginExecutionContext, TracingService)) { Trace(string.Format(CultureInfo.InvariantCulture, "{0} | {1} started at {2} milliseconds", UnderlyingSystemTypeName, MethodBase.GetCurrentMethod().Name, Stopwatch.ElapsedMilliseconds)); InitializeEntityService.InitializeEntity(); Trace(string.Format(CultureInfo.InvariantCulture, "{0} | {1} ended at {2} milliseconds", UnderlyingSystemTypeName, MethodBase.GetCurrentMethod().Name, Stopwatch.ElapsedMilliseconds)); } Trace(string.Format(CultureInfo.InvariantCulture, TraceMessageHelper.ExitingMethod, UnderlyingSystemTypeName, MethodBase.GetCurrentMethod().Name)); }