/// <inheritdoc /> async Task <IDictionaryRange <int, World> > IRepository <int, World> .FindAllAsync(CancellationToken cancellationToken) { IWorldRepository self = this; var request = new WorldNameRequest { Culture = self.Culture }; var response = await this.serviceClient.SendAsync <ICollection <WorldDTO> >(request, cancellationToken).ConfigureAwait(false); if (response.Content == null) { return(new DictionaryRange <int, World>(0)); } var worlds = new DictionaryRange <int, World>(response.Content.Count) { SubtotalCount = response.Content.Count, TotalCount = response.Content.Count }; foreach (var world in this.worldCollectionConverter.Convert(response.Content, response)) { world.Culture = request.Culture; worlds.Add(world.WorldId, world); } return(worlds); }
/// <inheritdoc /> IDictionaryRange <int, World> IRepository <int, World> .FindAll() { IWorldRepository self = this; var request = new WorldNameRequest { Culture = self.Culture }; var response = this.serviceClient.Send <ICollection <WorldDTO> >(request); if (response.Content == null) { return(new DictionaryRange <int, World>(0)); } var worlds = new DictionaryRange <int, World>(response.Content.Count) { SubtotalCount = response.Content.Count, TotalCount = response.Content.Count }; foreach (var world in this.worldCollectionConverter.Convert(response.Content, null)) { world.Culture = request.Culture; worlds.Add(world.WorldId, world); } return(worlds); }
/// <inheritdoc /> Task <IDictionaryRange <int, World> > IRepository <int, World> .FindAllAsync(CancellationToken cancellationToken) { IWorldRepository self = this; var request = new WorldNameRequest { Culture = self.Culture }; var responseTask = this.serviceClient.SendAsync <ICollection <WorldDataContract> >(request, cancellationToken); return(responseTask.ContinueWith(task => this.ConvertAsyncResponse(task, request.Culture), cancellationToken)); }