简体   繁体   中英

Microsoft Dynamics CRM Plugins

I am New for Dynamics CRM. I entered into Plugins some of the scenarios using LocalPluginContext and IServiceProvider , I want to know the differences for these LocalPluginContext and IServiceProvider , and when to use each one please someone describe.

Basically when you start developing plugin class library yourself in visual studio, you will go with basic skeleton along with boilerplate code that described in MSDN . This uses IServiceProvider directly to get all context & services.

public class FollowupPlugin: IPlugin
{
        public void Execute(IServiceProvider serviceProvider)
        {
            //Extract the tracing service for use in debugging sandboxed plug-ins.
            ITracingService tracingService =
                (ITracingService)serviceProvider.GetService(typeof(ITracingService));

            // Obtain the execution context from the service provider.
            IPluginExecutionContext context = (IPluginExecutionContext)
                serviceProvider.GetService(typeof(IPluginExecutionContext));

        }
}

Whereas CRM developer toolkit is an visual studio addin helps you to QuickStart Plugin development with templates. That gives you LocalPluginContext which allows easy access to the services provided by the IServiceProvider . It's a wrapper on top of native classes.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM