Plugin is a managed code class that runs under the Event Execution Pipeline. Under the pipeline, the developer can manage the entire behavior of the platform as it includes the entire process data of the execution pipeline. If it is well written, the performance of the plugin is optima. The developer can leverage the org service and the external service in the code. The plugin is powerful and most productive. However, to write plugin code, the developer needs special skills and knowledge. A poorly written plugin can have a significant impact on platform performance.
Basically, a plugin is just a .NET assembly that is implemented as the IPlugin interface, which can be found in the Microsoft.Crmsdk.CoreAssemblies NuGet package. The IPlugin interface exposes a single method, Execute, where we can place any custom logic.
Use Plugin when a declarative process doesn't our requirement.
Whenever a plugin is run, a stack of data is made available by the Microsoft Dataverse that contains information about the context in which the current operation resides. This plugin does business logic through an execution pipeline. Pipeline stages are selected according to business requirements or purposes.
IPlugin: IPlugin is important component for plugin design, It provides only one method, name Execute where developer can inject their business logic.
IServiceProvider:A container for service objects. Contains references to the plug-in execution context (IPluginExecutionContext), tracing service (ITracingService), organization service (IOrganizationServiceFactory), and notification service (IServiceEndpointNotificationService).
IPluginExecutionContext: IPluginExecutionContext provides access to the context for the event that executed the plugin.
GetService:The GetService method of this interface obtains the object that provides the service.
Summary:
A plugin is mandatory logic that should be used when a declarative process, such as a business rule, flow, or workflow, does not meet our requirement. Creating and maintaining plug-ins requires specialized skills of the developer. Developers are expensive and many businesses do not have access to one when needed. Business processes can change rapidly and providing options to enable change without the need for a developer can allow systems to adapt more quickly. A poorly written plug-in environment can have a significant impact on performance of platform.
Comments
Post a Comment