我是动态CRM的新手。我使用LocalPluginContext和IServiceProvider输入了插件中的一些场景,我想知道这些LocalPluginContext和IServiceProvider的不同之处,以及何时使用它们--请有人描述。
发布于 2018-09-11 22:23:32
基本上,当您在visual中开始开发插件类库时,您将使用MSDN描述的基本框架和样板代码。这直接使用IServiceProvider获取所有上下文和服务。
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));
}
}而CRM工具包是一个,它可以帮助您使用模板进行QuickStart插件开发。这为您提供了LocalPluginContext,它允许轻松访问IServiceProvider提供的服务。它是本机类之上的一个包装器。
https://stackoverflow.com/questions/52268857
复制相似问题