The following link is the official documentation on business events development; there may be some differences since the time of writing:
- In the official guide, the buildContract is marked as replaceable and hookable. This is not required, or desirable. These attributes make it so we can use a pre-post event handler and also avoid the call to next when using a Chain of Command. Pre-post event handlers should be avoided if possible, and if we do want this to be replaceable, we should use a delegate instead, as this allows extensions to play nice with each other.
- The official guide places the contract initialization in the contract itself. This isn't uncommon, but it is much cleaner to leave the data contract as just data members. This will be serialized to JSON so we only want elements in this contract that we want to serialize.
The business events development documentation can be found at: https://docs.microsoft.com/en-us/dynamics365/unified-operations/dev-itpro/business-events/business-events-dev-doc.