Skip to content

IHandleEventType interface

Duncan Jones edited this page Jun 7, 2019 · 1 revision

IHandleEventType interface

This interface tells a projection (derived from the ProjectionBase class) that the particular event type passed in should be handled (processed) by that projection when it encounters it while reading from the event stream.

You can implement this interface multiple times in a projection class - once for each type of event to handle.

    public class Balance
        : ProjectionBase,
        IHandleEventType<MoneyDeposited>,
        IHandleEventType<MoneyWithdrawn >

and for each of these a HandleEventInstance method will be required.

public void HandleEventInstance(MoneyDeposited eventInstance)
 {
     if (null != eventInstance )
     {
         currentBalance += eventInstance.AmountDeposited;
     }
 }