Event handler parameters
The first parameter on an IDO event handler method is the sender parameter, which is simply a reference to the IDO that initiated the event. This is equivalent to the IIDOExtensionClassContext.IDO property.
The second parameter is an instance of the IDOEventArgs class which allows you to access the original IDO request that initiated the event, and for the Post events, the IDO response also.
public class IDOEventArgs : EventArgs { public PayloadBase RequestPayload { get; } public PayloadBase ResponsePayload; }
This table describes the contents of the IDOEventArgs parameter for each IDO event:
Event | RequestPayload property | ResponsePayload field |
---|---|---|
PreLoadCollection | Contains an instance of the LoadCollectionRequestData class that the IDO is processing | Nothing |
PostLoadCollection | Contains an instance of the LoadCollectionRequestData class that the IDO processed | Contains an instance of the LoadCollectionResponseData class that will be returned to the caller |
PreUpdateCollection | Contains an instance of the UpdateCollectionRequestData class that the IDO is processing | Nothing |
PostUpdateCollection | Contains an instance of the UpdateCollectionRequestData class that the IDO processed | Contains an instance of the UpdateCollectionResponseData class that will be returned to the caller |
An event handler method can access the IDO request and response payloads as shown in this example:
private void HandlePreLoadCollection(object sender, IDOEventArgs args) { // Get the original request: LoadCollectionRequestData loadRequest; loadRequest = (LoadCollectionRequestData)args.RequestPayload; // ...Additional logic based on loadRequest. } private void HandlePostLoadCollection(object sender, IDOEventArgs args) { // Get the original request: LoadCollectionRequestData loadRequest; LoadCollectionResponseData loadResponse; loadRequest = (LoadCollectionRequestData)args.RequestPayload; loadResponse = (LoadCollectionResponseData)args.ResponsePayload; // ...Additional logic based on loadRequest or loadResponse. } private void HandlePreUpdateCollection(object sender, IDOEventArgs args) { // Get the original request: UpdateCollectionRequestData updateRequest; updateRequest = (UpdateCollectionRequestData)args.RequestPayload; // ...Additional logic based on updateRequest. } private void HandlePostUpdateCollection(object sender, IDOEventArgs args) { // Get the original request: UpdateCollectionRequestData updateRequest; UpdateCollectionResponseData updateResponse; updateRequest = (UpdateCollectionRequestData)args.RequestPayload; updateResponse = (UpdateCollectionResponseData)args.ResponsePayload; // ...Additional logic based on loadRequest or loadResponse. }