/// <summary>
 /// Register a new event handler for a retrieve multiple message using early bound entity types.
 /// </summary>
 /// <typeparam name="E"></typeparam>
 /// <param name="stage"></param>
 /// <param name="handler"></param>
 /// <param name="handlerId"></param>
 public void RegisterQueryHandler <E>(ePluginStage stage, Action <ICDSPluginExecutionContext, QueryExpression, EntityCollection> handler, string handlerId = "") where E : Entity, new()
 {
     this._events.Add(new QueryEventRegistration <E>
     {
         HandlerId    = handlerId,
         Stage        = stage,
         PluginAction = handler
     });
 }
 /// <summary>
 /// Register a new event handler for an update message using early bound entity types.
 /// </summary>
 /// <typeparam name="E"></typeparam>
 /// <param name="stage"></param>
 /// <param name="handler"></param>
 /// <param name="handlerId"></param>
 public void RegisterUpdateHandler <E>(ePluginStage stage, Action <ICDSPluginExecutionContext, E> handler, string handlerId = "") where E : Entity, new()
 {
     this._events.Add(new UpdateEventRegistration <E>
     {
         HandlerId    = handlerId,
         Stage        = stage,
         PluginAction = handler
     });
 }
 /// <summary>
 /// Register a new event handler for a retrieve message using early bound entity types.
 /// </summary>
 /// <typeparam name="E"></typeparam>
 /// <param name="stage"></param>
 /// <param name="handler"></param>
 /// <param name="handlerId"></param>
 public void RegisterRetrieveHandler <E>(ePluginStage stage, Action <ICDSPluginExecutionContext, EntityReference, ColumnSet, E> handler, string handlerId = "") where E : Entity, new()
 {
     this._events.Add(new RetrieveEventRegistration <E>
     {
         HandlerId    = handlerId,
         Stage        = stage,
         PluginAction = handler
     });
 }
 /// <summary>
 /// Register a new event handler for an action message using early bound action request and response types. Handler will
 /// </summary>
 /// <typeparam name="TRequest"></typeparam>
 /// <typeparam name="TResponse"></typeparam>
 /// <param name="stage"></param>
 /// <param name="handler"></param>
 /// <param name="handlerId"></param>
 public void RegisterActionHandler <TRequest, TResponse>(ePluginStage stage, Action <ICDSPluginExecutionContext, TRequest, TResponse> handler, string handlerId = "")
     where TRequest : OrganizationRequest, new()
     where TResponse : OrganizationResponse, new()
 {
     this._events.Add(new ActionEventRegistration <TRequest, TResponse>
     {
         Stage        = stage,
         HandlerId    = handlerId,
         PluginAction = handler
     });;
 }
 /// <summary>
 /// Adds a new event handler registration to link a plugin event signature to a specific handler.
 /// </summary>
 /// <param name="entityName"></param>
 /// <param name="messageName"></param>
 /// <param name="stage"></param>
 /// <param name="handler"></param>
 /// <param name="id"></param>
 public virtual void RegisterEventHandler(string entityName, string messageName, ePluginStage stage, Action <ICDSPluginExecutionContext> handler, string id = "")
 {
     this._events.Add(new PluginEventRegistration
     {
         EntityName   = entityName,
         MessageName  = messageName,
         Stage        = stage,
         PluginAction = handler,
         HandlerId    = id
     });
 }