熵片用到的 EntityCreatedEventDataTEntity,继承自EventData。 我们可以自定义事件: public class TestEvent: EventData { public int Id { get ; set ; } public string Name { get ; set ; } public int Age { get ; set ; } } 在聚合
熵片用到的 EntityCreatedEventData<TEntity>,继承自EventData。
我们可以自定义事件:
public class TestEvent: EventData { public int Id { get; set; } public string Name { get; set; } public int Age { get; set; } }
在聚合根中继承 IEventHandler<TestEvent>这个接口。
那么当应用层触发TestEvent 的时候,就会执行聚合根的领域事件。