public void AddFacility(FacilityName facilityName) { Apply(new FacilityAddedToSkiPass { SkiPassId = Id, FacilityId = new Guid(), // externally generated Name = facilityName }); }
protected override void When(object @event) { switch (@event) { case Events.FacilityAddedToSkiPass e: ParentId = new SkiPassId(e.SkiPassId); Id = new FacilityId(e.FacilityId); Name = new FacilityName(e.Name); break; case Events.FacilityNameChanged e: ParentId = new SkiPassId(e.SkiPassId); Id = new FacilityId(e.FacilityId); Name = new FacilityName(e.Name); break; } }