/// <summary> /// Map ships information. /// </summary> /// <param name="dataReader">The data reader.</param> /// <returns>ship information</returns> internal static async Task<ShipInfo> MapShipInfo(SqlDataReader dataReader) { var shipInfo = new ShipInfo(); if (dataReader != null) { shipInfo.AssignGangwayLocations(await MapGangwayLocations(dataReader)); await dataReader.NextResultAsync(); shipInfo.AssignStateroomCategories(await MapStateroomCategories(dataReader)); await dataReader.NextResultAsync(); shipInfo.AssignVoyageCollection(await MapVoyages(dataReader)); await dataReader.NextResultAsync(); var itineraries = await MapDictionaryAsync(dataReader); shipInfo.Voyages.AsParallel().Select(itinerary => { itinerary.MapMasterChildRelations(itineraries, master => master.VoyageId, (master, childs) => master.AssignItineraries(childs)); return true; }).ToList(); } return shipInfo; }