コード例 #1
0
 public void AddFacility(FacilityName facilityName)
 {
     Apply(new FacilityAddedToSkiPass
     {
         SkiPassId  = Id,
         FacilityId = new Guid(), // externally generated
         Name       = facilityName
     });
 }
コード例 #2
0
        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;
            }
        }