IServiceProvider

The Execute method of the IPlugin interface has only one parameter named IServiceProvider. From this parameter, we can get the plug-in execution context by entering the following code:

IPluginExecutionContext context = (IPluginExecutionContext)serviceProvider.GetService(typeof(IPluginExecution Context));

This main parameter has a method, GetService, that enables you to get other services from the service provider, such as the context of the organization and the context of the tracer service. This enables you to interact with the current CRM trace to add debugging information for the execution of your plug-in.

The IPluginExecutionContext now inherits the IExecutionContext, which is a more generic ...

Get Microsoft Dynamics CRM 2013 Unleashed now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.