public Schedule(PointInTime pointInTime) { Guard.Against.Null(() => pointInTime); if (pointInTime.IsBefore(DateTime.UtcNow)) { throw new BusinessException("Cannot create a schedule for a point in time that occurs in the past."); } this.Apply(Map.ValueObject(pointInTime).ToEvent <ScheduleCreated>()); }
private void Handle(ScheduleCreated @event) { this.PointInTime = Map.Event(@event).ToValueObject <PointInTime>(); }