protected override void When(object @event) { switch (@event) { case Events.ResourceRegistered e: Id = new ResourceId(e.ResourceId); ResourceName = new ResourceName(e.ResourceName); ResourceNo = new ResourceNo(e.ResourceNo); ResourcePrice = new ResourcePrice(e.ResourcePrice); break; case Events.ResourceDeleted e: Id = new ResourceId(e.ResourceId); IsDeleted = new IsDeleted(e.IsDeleted); break; case Events.ResourceNameUpdated e: Id = new ResourceId(e.ResourceId); ResourceName = new ResourceName(e.ResourceName); break; case Events.ResourceNoUpdated e: Id = new ResourceId(e.ResourceId); ResourceNo = new ResourceNo(e.ResourceNo); break; case Events.ResourcePriceUpdated e: Id = new ResourceId(e.ResourceId); ResourcePrice = new ResourcePrice(e.ResourcePrice); break; } }
public void UpdateResourceNo(ResourceNo resourceNo) { Apply(new Events.ResourceNoUpdated { ResourceId = Id, ResourceNo = resourceNo });; }
public Resource(ResourceId resourceId, ResourceName resourceName, ResourceNo resourceNo, ResourcePrice resourcePrice) { Apply(new Events.ResourceRegistered { ResourceId = resourceId, ResourceName = resourceName, ResourceNo = resourceNo, ResourcePrice = resourcePrice, }); }