/// <inheritdoc /> Task <IDictionaryRange <int, MapName> > IRepository <int, MapName> .FindAllAsync(CancellationToken cancellationToken) { IMapNameRepository self = this; var request = new MapNameRequest { Culture = self.Culture }; return(this.serviceClient.SendAsync <ICollection <MapNameDataContract> >(request, cancellationToken).ContinueWith <IDictionaryRange <int, MapName> >( task => { var response = task.Result; if (response.Content == null) { return new DictionaryRange <int, MapName>(0); } var values = response.Content.Select(value => this.converterForMapName.Convert(value, null)).ToList(); var mapNames = new DictionaryRange <int, MapName>(values.Count) { SubtotalCount = values.Count, TotalCount = values.Count }; foreach (var mapName in values) { mapName.Culture = request.Culture; mapNames.Add(mapName.MapId, mapName); } return mapNames; }, cancellationToken)); }
/// <inheritdoc /> IDictionaryRange <int, MapName> IRepository <int, MapName> .FindAll() { IMapNameRepository self = this; var request = new MapNameRequest { Culture = self.Culture }; var response = this.serviceClient.Send <ICollection <MapNameDataContract> >(request); if (response.Content == null) { return(new DictionaryRange <int, MapName>(0)); } var values = response.Content.Select(value => this.converterForMapName.Convert(value, null)).ToList(); var mapNames = new DictionaryRange <int, MapName>(values.Count) { SubtotalCount = values.Count, TotalCount = values.Count }; foreach (var mapName in values) { mapName.Culture = request.Culture; mapNames.Add(mapName.MapId, mapName); } return(mapNames); }
/// <inheritdoc /> async Task <IDictionaryRange <int, MapName> > IRepository <int, MapName> .FindAllAsync(CancellationToken cancellationToken) { IMapNameRepository self = this; var request = new MapNameRequest { Culture = self.Culture }; var response = await this.serviceClient.SendAsync <ICollection <MapNameDTO> >(request, cancellationToken).ConfigureAwait(false); if (response.Content == null) { return(new DictionaryRange <int, MapName>(0)); } var values = response.Content.Select(value => this.mapNameConverter.Convert(value, null)).ToList(); var mapNames = new DictionaryRange <int, MapName>(values.Count) { SubtotalCount = values.Count, TotalCount = values.Count }; foreach (var mapName in values) { mapName.Culture = request.Culture; mapNames.Add(mapName.MapId, mapName); } return(mapNames); }