Plug-In Deployment and Registration
The unified event API in Microsoft Dynamics CRM 4.0 exposes methods that allow registering and unregistering plug-ins. You can deploy plug-ins either in the database or on a local disk; however, the recommended method is to deploy plug-ins in the database for easier distribution and maintainability. The disk deployment option is provided for backward compatibility with Microsoft Dynamics CRM 3.0 callouts.
You can also use the Plug-in Registration Tool available in the Microsoft Dynamics CRM 4.0 SDK, which is located in the tools\pluginregistration folder under the SDK. The tool is available as source code. Open the pluginregistration solution and run the project from Visual Studio.
In the plug-in registration tool (see Figure 2) enter the CRM server information and click Connect.
After logging in, you'll see a list of registered plug-ins and workflows displayed under each organizational unit (see Figure 3). You can use the Register menu to register plug-in assemblies and their steps.
Critical Info
There are a few important things to keep in mind about plug-ins:
Plug-in correlation: Certain scenarios might cause a plug-in step to execute in an infinite loop. For example a plug-in registered for an update event on an account updates the account on being executed. Always use the plug-in context to create a proxy to the CrmService because it can detect infinite loops. You can use the CreateCrmService method of the plug-in context to create a CrmService proxy. If you need to create a CrmService instance in the plug-in, set the service's CorrelationTokenValue property to a new instance of CorrelationToken class. The plug-in context CorrelationId, Depth and CorrelationUpdatedTime are passed in as instance parameters. The CorrelationToken class makes use of soap headers to maintain the context association with the caller.
Shared Variables: The plug-in context has a SharedVariables property bag that holds properties that plug-ins registered at different stages of the pipeline can share.
Offline support: You can register plug-ins for execution in offline mode. This feature allows support for plug-ins in Microsoft Dynamics CRM for Outlook. The plug-in context has an IsExecutingInOfflineMode property to check if the plug-in is being executed in offline mode.
For Further Reading
For more information, these two links are good places to start: