Microsoft Dynamics CRM 插件
Microsoft Dynamics CRM Plugins
我是 Dynamics CRM 的新手。我使用 LocalPluginContext
和 IServiceProvider
进入了插件的一些场景,我想知道这些 LocalPluginContext
和 IServiceProvider
的区别,以及何时使用它们,请有人描述.
基本上,当您在 visual studio 开始自己开发插件 class 库时,您将使用基本框架以及 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 开发人员工具包是一个 visual studio 插件,可帮助您使用模板快速启动插件开发。这使您 LocalPluginContext
可以轻松访问 IServiceProvider
提供的服务。它是原生 classes.
之上的包装器
我是 Dynamics CRM 的新手。我使用 LocalPluginContext
和 IServiceProvider
进入了插件的一些场景,我想知道这些 LocalPluginContext
和 IServiceProvider
的区别,以及何时使用它们,请有人描述.
基本上,当您在 visual studio 开始自己开发插件 class 库时,您将使用基本框架以及 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 开发人员工具包是一个 visual studio 插件,可帮助您使用模板快速启动插件开发。这使您 LocalPluginContext
可以轻松访问 IServiceProvider
提供的服务。它是原生 classes.