public void Execute(IServiceProvider serviceProvider) { ITracingService tracing = null; try { IPluginExecutionContext context = (IPluginExecutionContext)serviceProvider.GetService(typeof(IPluginExecutionContext)); IOrganizationServiceFactory serviceFactory = (IOrganizationServiceFactory)serviceProvider.GetService(typeof(IOrganizationServiceFactory)); tracing = (ITracingService)serviceProvider.GetService(typeof(ITracingService)); //Garante que o serviço será criado na execução deste plugin IOrganizationService adminService = serviceFactory.CreateOrganizationService(null); IOrganizationService userService = serviceFactory.CreateOrganizationService(context.UserId); bool applicationOrigin = context.ObterApplicationOrigin(); Execute(context, serviceFactory, adminService, userService); } catch (Exception ex) { string message = SDKore.Helper.Error.Handler(ex); tracing.Trace(SDKore.Helper.Error.GetMessageError(ex)); throw new InvalidPluginExecutionException(message, ex); } }