Skip to content

Instantly share code, notes, and snippets.

@gashupl
Created April 23, 2019 18:07
Show Gist options
  • Save gashupl/c4ce7404ef9d99286cae9dc40127c170 to your computer and use it in GitHub Desktop.
Save gashupl/c4ce7404ef9d99286cae9dc40127c170 to your computer and use it in GitHub Desktop.
public void Execute(IServiceProvider serviceProvider)
{
if (serviceProvider == null)
{
throw new ArgumentNullException(nameof(serviceProvider));
}
ITracingService tracingService = (ITracingService)serviceProvider.GetService(typeof(ITracingService));
if (tracingService == null)
{
throw new ApplicationException("Failed to initialize plugin tracing service");
}
IPluginExecutionContext pluginExecutionContext = (IPluginExecutionContext)serviceProvider.GetService(typeof(IPluginExecutionContext));
if (pluginExecutionContext == null)
{
throw new ApplicationException("Failed to initialize plugin execution context");
}
//…
}
#region Abstract methods
public abstract bool IsContextValid(IPluginExecutionContext context);
public abstract void Execute(IPluginExecutionContext pluginExecutionContext, ITracingService tracingService);
#endregion
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment