Ejemplo n.º 1
0
        public void Execute(IServiceProvider serviceProvider)
        {
            IPluginExecutionContext     context  = (IPluginExecutionContext)serviceProvider.GetService(typeof(IPluginExecutionContext));
            IOrganizationServiceFactory sFactory = (IOrganizationServiceFactory)serviceProvider.GetService(typeof(IOrganizationServiceFactory));

            SystemInitialzation.Start(sFactory, context);

            if (!OverrideExecute())
            {
                using (var appResult = _appPluginContextService.Do(serviceProvider))
                {
                    try
                    {
                        InnerExecute(context);
                    }
                    catch (Exception ex)
                    {
                        if (ex is UtilityException)
                        {
                            throw new InvalidPluginExecutionException(ex.GetCurrentLcidMessageSync());
                        }
                        else
                        {
                            throw new InvalidPluginExecutionException(ex.ToString() + ex.StackTrace);
                        }
                    }
                }
            }
            else
            {
                InnerOverrideExecute(context, serviceProvider);
            }
        }
Ejemplo n.º 2
0
        protected override void Execute(CodeActivityContext context)
        {
            IWorkflowContext            wfContext = context.GetExtension <IWorkflowContext>();
            IOrganizationServiceFactory sFactory  = (IOrganizationServiceFactory)context.GetExtension <IOrganizationServiceFactory>();


            SystemInitialzation.Start(sFactory, wfContext);

            if (!OverrideExecute())
            {
                using (var appResult = _appWorkflowContextService.Init(context))
                {
                    try
                    {
                        InnerExecute(context, wfContext);
                    }
                    catch (Exception ex)
                    {
                        if (ex is UtilityException)
                        {
                            throw new InvalidPluginExecutionException(ex.GetCurrentLcidMessageSync());
                        }
                        else
                        {
                            throw new InvalidPluginExecutionException(ex.ToString() + ex.StackTrace);
                        }
                    }
                }
            }
            else
            {
                InnerOverrideExecute(context, wfContext);
            }
        }