public AggregateRoot <Flight> Deserialize(JsonSerializerSettings jsonSerializerSettings) { var flight = JsonConvert.DeserializeObject <Flight>(JsonDocument, jsonSerializerSettings) ?? throw new DataException($"JsonDocument is null."); var versionTag = VersionTagConverter.FromBytes(VersionTag); return(AggregateRoot.Create(flight, versionTag)); }
public FlightDetails Deserialize(JsonSerializerSettings jsonSerializerSettings) { var versionTag = VersionTagConverter.FromBytes(VersionTag); var bookings = JsonConvert.DeserializeObject <IEnumerable <Booking> >(Bookings, jsonSerializerSettings) ?? throw new DataException($"JsonDocument is null."); return(new FlightDetails( new FlightId(Id), versionTag, Capacity, bookings)); }