/// <summary> /// Initializes the plugin properties. /// </summary> /// <param name="context">The context.</param> /// <param name="plugin">The plugin.</param> private void InitializePluginProperties(IPluginExecutionContext context, IRegisteredEventsPluginHandler plugin) { // Iterate over all of the expected registered events to ensure that the plugin // has been invoked by an expected event // For any given plug-in event at an instance in time, we would expect at most 1 result to match. Event = plugin.RegisteredEvents.FirstOrDefault(a => (int)a.Stage == context.Stage && a.MessageName == context.MessageName && (string.IsNullOrWhiteSpace(a.EntityLogicalName) || a.EntityLogicalName == context.PrimaryEntityName) ); PluginTypeName = plugin.GetType().FullName; }
/// <summary> /// Initializes the plugin properties. /// </summary> /// <param name="context">The context.</param> /// <param name="plugin">The plugin.</param> private void InitializePluginProperties(IPluginExecutionContext context, IRegisteredEventsPluginHandler plugin) { Event = context.GetEvent(plugin.RegisteredEvents); IsolationMode = (IsolationMode)context.IsolationMode; PluginTypeName = plugin.GetType().FullName; }