public void Execute(IServiceProvider serviceProvider)
        {
            string entityType;
            var    context        = (IPluginExecutionContext)serviceProvider.GetService(typeof(IPluginExecutionContext));
            var    message        = context.MessageName;
            var    isRelationship = message == PluginMessage.Associate || message == PluginMessage.Disassociate;

            entityType = GetTypeSchemaName(context, isRelationship);

            var plugin = CreateEntityPlugin(entityType, isRelationship);

            if (plugin != null)
            {
                plugin.ServiceProvider = serviceProvider;
                RegisterTypes(plugin);
                XrmPlugin.Go(plugin);
            }
        }
 public static void Go(XrmPlugin plugin)
 {
     try
     {
         plugin.Go();
     }
     catch (InvalidPluginExecutionException ex)
     {
         //ADDED 10000 Limit To Trace As Was Receiving Buffer Exceeded Error
         //Couldn;t figure out where to increase buffer size
         plugin.Trace(ex.DisplayString().Left(10000));
         throw;
     }
     catch (Exception ex)
     {
         plugin.Trace(ex.DisplayString().Left(10000));
         throw new InvalidPluginExecutionException(ex.Message, ex);
     }
 }