VaughnVernon/IDDD_Samples_NET

EventSourcedAggregateRoot dynamic apply

leonfs opened this issue · 1 comments

   void When(IDomainEvent e)
    {
        (this as dynamic).Apply(e);
  }

    protected void Apply(IDomainEvent e)
    {
        this.mutatingEvents.Add(e);
        When(e);
    }

This code doesn't work, it generates an StackOverflow exception due to it's infinite recursion.