Beispiel #1
0
        /// <summary>Finds the object with the given identifier.</summary>
        /// <param name="identifier">The identifier of the object to find.</param>
        /// <exception cref="NotSupportedException">The data source does not support searching by identifier.</exception>
        /// <exception cref="ServiceException">An error occurred while retrieving data from the data source.</exception>
        /// <returns>The object with the given identifier, or a null reference.</returns>
        Character IRepository <string, Character> .Find(string identifier)
        {
            var request = new CharacterDetailsRequest
            {
                Identifier = identifier,
                Culture    = ((ICharacterRepository)this).Culture
            };
            var response = this.serviceClient.Send <CharacterDTO>(request);

            return(this.responseConverter.Convert(response, null));
        }
Beispiel #2
0
        /// <summary>Finds the object with the given identifier.</summary>
        /// <param name="identifier">The identifier of the object to find.</param>
        /// <param name="cancellationToken">The <see cref="CancellationToken"/> that provides cancellation support.</param>
        /// <exception cref="NotSupportedException">The data source does not support searching by identifier.</exception>
        /// <exception cref="ServiceException">An error occurred while retrieving data from the data source.</exception>
        /// <exception cref="TaskCanceledException">A task was canceled.</exception>
        /// <returns>The object with the given identifier, or a null reference.</returns>
        async Task <Character> IRepository <string, Character> .FindAsync(string identifier, CancellationToken cancellationToken)
        {
            var request = new CharacterDetailsRequest
            {
                Identifier = identifier,
                Culture    = ((ICharacterRepository)this).Culture
            };
            var response = await this.serviceClient.SendAsync <CharacterDTO>(request, cancellationToken).ConfigureAwait(false);

            return(this.responseConverter.Convert(response, null));
        }
        /// <summary>Finds the object with the given identifier.</summary>
        /// <param name="identifier">The identifier of the object to find.</param>
        /// <param name="cancellationToken">The <see cref="CancellationToken"/> that provides cancellation support.</param>
        /// <exception cref="NotSupportedException">The data source does not support searching by identifier.</exception>
        /// <exception cref="ServiceException">An error occurred while retrieving data from the data source.</exception>
        /// <exception cref="TaskCanceledException">A task was canceled.</exception>
        /// <returns>The object with the given identifier, or a null reference.</returns>
        Task <Character> IRepository <string, Character> .FindAsync(string identifier, CancellationToken cancellationToken)
        {
            var request = new CharacterDetailsRequest
            {
                Identifier = identifier,
                Culture    = ((ICharacterRepository)this).Culture
            };
            var response = this.serviceClient.SendAsync <CharacterDataContract>(request, cancellationToken);

            return(response.ContinueWith <Character>(this.ConvertAsyncResponse, cancellationToken));
        }