コード例 #1
0
 public Task<IServiceFilterResponse> Handle(IServiceFilterRequest request, IServiceFilterContinuation continuation)
 {
     Request = request;
     var tcs = new TaskCompletionSource<IServiceFilterResponse>();
     tcs.SetResult (Response);
     return tcs.Task;
 }
コード例 #2
0
            public IAsyncOperation <IServiceFilterResponse> Handle(IServiceFilterRequest request, IServiceFilterContinuation continuation)
            {
                TaskCompletionSource <IServiceFilterResponse> tcs = new TaskCompletionSource <IServiceFilterResponse>();

                tcs.SetResult(new MyResponse(this.statusCode, this.statusDescription, this.contentType, this.content));
                return(tcs.Task.AsAsyncOperation());
            }
コード例 #3
0
            public async Task <IServiceFilterResponse> HandleRequest(IServiceFilterRequest request, IServiceFilterContinuation continuation)
            {
                IServiceFilterResponse response = null;

                try
                {
                    for (int i = 0; i < this.NumberOfRequests; i++)
                    {
                        response = await continuation.Handle(request);

                        test.AddLog("Sent the request number {0}", i + 1);
                        test.AddLog("Response: {0} - {1}", response.StatusCode, response.StatusDescription);
                        if (response.StatusCode >= 400)
                        {
                            test.AddLog("Invalid response. Content-Type: {0}", response.ContentType);
                            test.AddLog("Response content: {0}", response.Content);
                            throw new InvalidOperationException();
                        }
                    }
                }
                catch (Exception ex)
                {
                    test.AddLog("Exception while calling continuation: {0}", ex);
                    this.TestFailed = true;
                    throw;
                }

                return(response);
            }
コード例 #4
0
 private Task<IServiceFilterResponse> Log(IServiceFilterRequest request, IServiceFilterContinuation next)
 {
     //Test.Log("    >>> {0} {1} {2}", request.Method, request.Uri, request.Content);
     //IServiceFilterResponse response = await next.Handle(request).AsTask();
     //Test.Log("    <<< {0} {1} {2}", response.StatusCode, response.StatusDescription, response.Content);
     return next.Handle (request);;
 }
コード例 #5
0
ファイル: ToDoActivity.cs プロジェクト: yuva2achieve/dot42
            public void HandleRequest(IServiceFilterRequest request, INextServiceFilterCallback nextServiceFilterCallback,
                                      IServiceFilterResponseCallback responseCallback)
            {
                mToDoActivity.RunOnUiThread(new MyRunnable(mToDoActivity.mProgressBar, ProgressBar.VISIBLE));

                nextServiceFilterCallback.OnNext(request, new MyServiceFilterResponseCallback(mToDoActivity, responseCallback));
            }
コード例 #6
0
 private static Exception CreateMobileServiceException(string errorMessage, IServiceFilterRequest request, IServiceFilterResponse response)
 {
     Debug.Assert(!string.IsNullOrEmpty(errorMessage), "errorMessage cannot be null or empty!");
     Debug.Assert(request != null, "request cannot be null!");
     Debug.Assert(response != null, "response cannot be null!");
     return(new InvalidOperationException(errorMessage));
 }
コード例 #7
0
 private static Exception CreateMobileServiceException(string errorMessage, IServiceFilterRequest request, IServiceFilterResponse response)
 {
     Debug.Assert(!string.IsNullOrEmpty(errorMessage), "errorMessage cannot be null or empty!");
     Debug.Assert(request != null, "request cannot be null!");
     Debug.Assert(response != null, "response cannot be null!");
     return new InvalidOperationException(errorMessage);
 }
コード例 #8
0
 private Task <IServiceFilterResponse> Log(IServiceFilterRequest request, IServiceFilterContinuation next)
 {
     //Test.Log("    >>> {0} {1} {2}", request.Method, request.Uri, request.Content);
     //IServiceFilterResponse response = await next.Handle(request).AsTask();
     //Test.Log("    <<< {0} {1} {2}", response.StatusCode, response.StatusDescription, response.Content);
     return(next.Handle(request));;
 }
コード例 #9
0
 public Task<IServiceFilterResponse> Handle(IServiceFilterRequest request, IServiceFilterContinuation continuation)
 {
     Request = request;
     //return Task.FromResult<IServiceFilterResponse>(Response).AsAsyncOperation();
     var tcs = new TaskCompletionSource<IServiceFilterResponse>();
     tcs.SetResult(Response);
     return tcs.Task;
 }
コード例 #10
0
 /// <summary>
 /// Provide an implementation of the default next continuation which
 /// just returns the response corresponding to a request.
 /// </summary>
 /// <param name="request">The HTTP request.</param>
 /// <returns>The HTTP response.</returns>
 Task<IServiceFilterResponse> IServiceFilterContinuation.Handle(IServiceFilterRequest request)
 {
     if (request == null)
     {
         throw new ArgumentNullException("request");
     }
     return request.GetResponse();
 }
コード例 #11
0
 /// <summary>
 /// Provide an implementation of the default next continuation which
 /// just returns the response corresponding to a request.
 /// </summary>
 /// <param name="request">The HTTP request.</param>
 /// <returns>The HTTP response.</returns>
 Task <IServiceFilterResponse> IServiceFilterContinuation.Handle(IServiceFilterRequest request)
 {
     if (request == null)
     {
         throw new ArgumentNullException("request");
     }
     return(request.GetResponse());
 }
コード例 #12
0
        public Task <IServiceFilterResponse> Handle(IServiceFilterRequest request, IServiceFilterContinuation continuation)
        {
            Request = request;
            var tcs = new TaskCompletionSource <IServiceFilterResponse>();

            tcs.SetResult(Response);
            return(tcs.Task);
        }
コード例 #13
0
 /// <summary>
 /// Apply a chain of IServiceFilters to an HTTP request and get the
 /// corresponding HTTP response.
 /// </summary>
 /// <param name="request">The HTTP request.</param>
 /// <param name="filter">
 /// The filter (or chain of filters composed together into a single
 /// filter) to apply to the request to obtain the response.
 /// </param>
 /// <returns>The HTTP response.</returns>
 public static Task<IServiceFilterResponse> ApplyAsync(IServiceFilterRequest request, IServiceFilter filter)
 {
     return (filter != null) ?
         // If we have a filter, create a new instance of this type to
         // provide the final default continuation
         filter.Handle(request, new ServiceFilter()) :
         // If we don't have a filter, just return the response directly
         request.GetResponse();
 }
コード例 #14
0
 /// <summary>
 /// Apply a chain of IServiceFilters to an HTTP request and get the
 /// corresponding HTTP response.
 /// </summary>
 /// <param name="request">The HTTP request.</param>
 /// <param name="filter">
 /// The filter (or chain of filters composed together into a single
 /// filter) to apply to the request to obtain the response.
 /// </param>
 /// <returns>The HTTP response.</returns>
 public static async Task <IServiceFilterResponse> ApplyAsync(IServiceFilterRequest request, IServiceFilter filter)
 {
     return((filter != null) ?
            // If we have a filter, create a new instance of this type to
            // provide the final default continuation
            await filter.Handle(request, new ServiceFilter()) :
            // If we don't have a filter, just return the response directly
            await request.GetResponse());
 }
コード例 #15
0
        public Task <IServiceFilterResponse> Handle(IServiceFilterRequest request, IServiceFilterContinuation continuation)
        {
            Request = request;
            //return Task.FromResult<IServiceFilterResponse>(Response).AsAsyncOperation();
            var tcs = new TaskCompletionSource <IServiceFilterResponse>();

            tcs.SetResult(Response);
            return(tcs.Task);
        }
コード例 #16
0
            /// <summary>
            /// Handle an HTTP request and its corresponding response.
            /// </summary>
            /// <param name="request">The HTTP request.</param>
            /// <returns>The HTTP response.</returns>
            public Task <IServiceFilterResponse> Handle(IServiceFilterRequest request)
            {
                if (request == null)
                {
                    throw new ArgumentNullException("request");
                }

                // Filter(next(request))
                return(this.Filter.Handle(request, this.Next));
            }
コード例 #17
0
        /// <summary>
        /// Throw an exception for an invalid response to a web request.
        /// </summary>
        /// <param name="request">The request.</param>
        /// <param name="response">The response.</param>
        /// <param name="body">The body of the response as JSON.</param>
        private static void ThrowInvalidResponse(IServiceFilterRequest request, IServiceFilterResponse response, IJsonValue body)
        {
            Debug.Assert(request != null, "request cannot be null!");
            Debug.Assert(response != null, "response cannot be null!");
            Debug.Assert(
                response.ResponseStatus != ServiceFilterResponseStatus.Success ||
                response.StatusCode >= 400,
                "response should be failing!");

            // Create either an invalid response or connection failed message
            // (check the status code first because some status codes will
            // set a protocol ErrorStatus).
            string message = null;

            if (response.StatusCode >= 400)
            {
                if (body != null)
                {
                    if (body.ValueType == JsonValueType.String)
                    {
                        // User scripts might return errors with just a plain string message as the
                        // body content, so use it as the exception message
                        message = body.GetString();
                    }
                    else if (body.ValueType == JsonValueType.Object)
                    {
                        // Get the error message, but default to the status description
                        // below if there's no error message present.
                        message = body.Get("error").AsString() ??
                                  body.Get("description").AsString();
                    }
                }

                if (string.IsNullOrWhiteSpace(message))
                {
                    message = string.Format(
                        CultureInfo.InvariantCulture,
                        Resources.MobileServiceClient_ErrorMessage,
                        response.StatusDescription);
                }
            }
            else
            {
                message = string.Format(
                    CultureInfo.InvariantCulture,
                    Resources.MobileServiceClient_ErrorMessage,
                    response.ResponseStatus);
            }

            // Combine the pieces and throw the exception
            throw CreateMobileServiceException(message, request, response);
        }
コード例 #18
0
        /// <summary>
        /// Handle an HTTP request and its corresponding response by applying
        /// the first filter and then the second filter.
        /// </summary>
        /// <param name="request">The HTTP request.</param>
        /// <param name="next">
        /// The next operation in the HTTP pipeline to continue with.
        /// </param>
        /// <returns>The HTTP response.</returns>
        public IAsyncOperation<IServiceFilterResponse> Handle(IServiceFilterRequest request, IServiceFilterContinuation next)
        {
            if (request == null)
            {
                throw new ArgumentNullException("request");
            }
            else if (next == null)
            {
                throw new ArgumentNullException("next");
            }

            // Second(First(next(request))
            return this.Second.Handle(request, new ComposedContinuation(this.First, next));
        }
コード例 #19
0
        /// <summary>
        /// Handle an HTTP request and its corresponding response by applying
        /// the first filter and then the second filter.
        /// </summary>
        /// <param name="request">The HTTP request.</param>
        /// <param name="next">
        /// The next operation in the HTTP pipeline to continue with.
        /// </param>
        /// <returns>The HTTP response.</returns>
        public Task <IServiceFilterResponse> Handle(IServiceFilterRequest request, IServiceFilterContinuation next)
        {
            if (request == null)
            {
                throw new ArgumentNullException("request");
            }
            else if (next == null)
            {
                throw new ArgumentNullException("next");
            }

            // Second(First(next(request))
            return(this.Second.Handle(request, new ComposedContinuation(this.First, next)));
        }
コード例 #20
0
        /// <summary>
        /// Throw an exception for an invalid response to a web request.
        /// </summary>
        /// <param name="request">The request.</param>
        /// <param name="response">The response.</param>
        /// <param name="body">The body of the response as JSON.</param>
        private static void ThrowInvalidResponse(IServiceFilterRequest request, IServiceFilterResponse response, IJsonValue body)
        {
            Debug.Assert(request != null, "request cannot be null!");
            Debug.Assert(response != null, "response cannot be null!");
            Debug.Assert(
                response.ResponseStatus != ServiceFilterResponseStatus.Success ||
                response.StatusCode >= 400,
                "response should be failing!");

            // Create either an invalid response or connection failed message
            // (check the status code first because some status codes will
            // set a protocol ErrorStatus).
            string message = null;

            if (response.StatusCode >= 400)
            {
                // Get the error message, but default to the status message
                // if there's no error message present.
                string error =
                    body.Get("error").AsString() ??
                    body.Get("description").AsString() ??
                    response.StatusDescription;

                // Get the status code, text
                int code = body.Get("code").AsInteger() ?? response.StatusCode;

                // Combine the pieces and throw the exception
                message =
                    string.Format(CultureInfo.InvariantCulture,
                                  Resources.MobileServiceClient_ThrowInvalidResponse_ErrorMessage,
                                  code,
                                  (HttpStatusCode)code,
                                  error,
                                  response.Content);
            }
            else
            {
                message = string.Format(
                    CultureInfo.InvariantCulture,
                    Resources.MobileServiceClient_ThrowConnectionFailure_ErrorMessage,
                    response.ResponseStatus);
            }

            // Combine the pieces and throw the exception
            throw CreateMobileServiceException(message, request, response);
        }
コード例 #21
0
        public IAsyncOperation <IServiceFilterResponse> Handle(IServiceFilterRequest request, IServiceFilterContinuation continuation)
        {
            // Add master key to the request's header to have admin level control
            request.Headers["X-ZUMO-MASTER"] = this.masterKey;

            if (this.disableScripts)
            {
                // Get the request's query and append noScript=true as the first query parameter
                var uriBuilder = new UriBuilder(request.Uri);
                var oldQuery   = (uriBuilder.Query ?? string.Empty).Trim('?');

                uriBuilder.Query = ("noScript=true&" + oldQuery).Trim('&');

                request.Uri = uriBuilder.Uri;
            }

            return(continuation.Handle(request));
        }
コード例 #22
0
        public IAsyncOperation<IServiceFilterResponse> Handle(IServiceFilterRequest request, IServiceFilterContinuation continuation)
        {
            // Add master key to the request's header to have admin level control
            request.Headers["X-ZUMO-MASTER"] = this.masterKey;

            if (this.disableScripts)
            {
                // Get the request's query and append noScript=true as the first query parameter
                var uriBuilder = new UriBuilder(request.Uri);
                var oldQuery = (uriBuilder.Query ?? string.Empty).Trim('?');

                uriBuilder.Query = ("noScript=true&" + oldQuery).Trim('&');

                request.Uri = uriBuilder.Uri;
            }

            return continuation.Handle(request);
        }
コード例 #23
0
        private async Task <IServiceFilterResponse> HandleAsync(IServiceFilterRequest request,
                                                                IServiceFilterContinuation continuation)
        {
            int ic = _callCount;

            bool invokeBusy = false;

            lock (_countLock)
            {
                if (_callCount == 0)
                {
                    invokeBusy = true;
                }
                _callCount++;
            }

            if (invokeBusy)
            {
                _busyIndicator.Invoke(true);
            }

            IServiceFilterResponse response = await continuation.Handle(request).AsTask();

            bool invokeIdle = false;

            lock (_countLock)
            {
                if (_callCount == 1)
                {
                    invokeIdle = true;
                }
                _callCount--;
            }

            if (invokeIdle)
            {
                _busyIndicator.Invoke(false);
            }

            return(response);
        }
コード例 #24
0
        public IAsyncOperation<IServiceFilterResponse> Handle(IServiceFilterRequest request, IServiceFilterContinuation continuation)
        {
            // Get previous uri query
            var uriBuilder = new UriBuilder(request.Uri);
            var oldQuery = (uriBuilder.Query ?? string.Empty).Trim('?');

            // Build new query starting with our custom parameters before old query
            var stringBuilder = new StringBuilder();
            foreach (var parameter in parameters)
            {
                // Currently using ToString on the value, an improvement will be to serialize the object properly
                stringBuilder.AppendFormat("{0}={1}&", parameter.Key, parameter.Value);
            }
            stringBuilder.Append(oldQuery);

            // Apply new query to request uri
            uriBuilder.Query = stringBuilder.ToString().Trim('&');
            request.Uri = uriBuilder.Uri;

            return continuation.Handle(request);
        }
コード例 #25
0
        private async Task<IServiceFilterResponse> HandleAsync(IServiceFilterRequest request,
            IServiceFilterContinuation continuation)
        {
            int ic = _callCount;

            bool invokeBusy = false;

            lock (_countLock)
            {
                if (_callCount == 0)
                {
                    invokeBusy = true;
                }
                _callCount++;
            }
         
            if (invokeBusy)
            {
                _busyIndicator.Invoke(true);
            }

            IServiceFilterResponse response = await continuation.Handle(request).AsTask();

            bool invokeIdle = false;

            lock (_countLock)
            {
                if (_callCount == 1)
                {
                    invokeIdle = true;
                }
                _callCount--;
            }

            if (invokeIdle) {
                _busyIndicator.Invoke(false);
            }

            return response;
        }
コード例 #26
0
            public IAsyncOperation <IServiceFilterResponse> Handle(IServiceFilterRequest request, IServiceFilterContinuation continuation)
            {
                this.RequestHeaders.Clear();
                foreach (var reqHeader in request.Headers.Keys)
                {
                    this.RequestHeaders.Add(reqHeader, request.Headers[reqHeader]);
                }

                return(continuation.Handle(request).AsTask().ContinueWith <IServiceFilterResponse>(t =>
                {
                    this.ResponseHeaders.Clear();
                    var response = t.Result;
                    foreach (var respHeader in response.Headers.Keys)
                    {
                        this.ResponseHeaders.Add(respHeader, response.Headers[respHeader]);
                    }

                    this.ResponseBody = response.Content;

                    return response;
                }).AsAsyncOperation());
            }
コード例 #27
0
 public IAsyncOperation<IServiceFilterResponse> Handle(IServiceFilterRequest request, IServiceFilterContinuation continuation)
 {
     Request = request;
     return Task.FromResult<IServiceFilterResponse>(Response).AsAsyncOperation();
 }
コード例 #28
0
 public IAsyncOperation<IServiceFilterResponse> Handle(IServiceFilterRequest request, IServiceFilterContinuation continuation)
 {
     request.Headers.Add("x-zumo-master", E2EZumoHelper.AppMasterKey);
     return continuation.Handle(request);
 }
コード例 #29
0
            public IAsyncOperation<IServiceFilterResponse> Handle(IServiceFilterRequest request, IServiceFilterContinuation continuation)
            {
                this.RequestHeaders.Clear();
                foreach (var reqHeader in request.Headers.Keys)
                {
                    this.RequestHeaders.Add(reqHeader, request.Headers[reqHeader]);
                }

                return continuation.Handle(request).AsTask().ContinueWith<IServiceFilterResponse>(t =>
                {
                    this.ResponseHeaders.Clear();
                    var response = t.Result;
                    foreach (var respHeader in response.Headers.Keys)
                    {
                        this.ResponseHeaders.Add(respHeader, response.Headers[respHeader]);
                    }

                    this.ResponseBody = response.Content;

                    return response;
                }).AsAsyncOperation();
            }
コード例 #30
0
            /// <summary>
            /// Handle an HTTP request and its corresponding response.
            /// </summary>
            /// <param name="request">The HTTP request.</param>
            /// <returns>The HTTP response.</returns>
            public IAsyncOperation<IServiceFilterResponse> Handle(IServiceFilterRequest request)
            {
                if (request == null)
                {
                    throw new ArgumentNullException("request");
                }

                // Filter(next(request))
                return this.Filter.Handle(request, this.Next);
            }
コード例 #31
0
 public IAsyncOperation<IServiceFilterResponse> Handle(IServiceFilterRequest request, IServiceFilterContinuation continuation)
 {
     return this.HandleRequest(request, continuation).AsAsyncOperation();
 }
コード例 #32
0
        /// <summary>
        /// Throw an exception for an invalid response to a web request.
        /// </summary>
        /// <param name="request">The request.</param>
        /// <param name="response">The response.</param>
        /// <param name="body">The body of the response as JSON.</param>
        private static void ThrowInvalidResponse(IServiceFilterRequest request, IServiceFilterResponse response, IJsonValue body)
        {
            Debug.Assert(request != null, "request cannot be null!");
            Debug.Assert(response != null, "response cannot be null!");
            Debug.Assert(
                response.ResponseStatus != ServiceFilterResponseStatus.Success ||
                    response.StatusCode >= 400,
                "response should be failing!");

            // Create either an invalid response or connection failed message
            // (check the status code first because some status codes will
            // set a protocol ErrorStatus).
            string message = null;
            if (response.StatusCode >= 400)
            {
                if (body != null)
                {
                    if (body.ValueType == JsonValueType.String)
                    {
                        // User scripts might return errors with just a plain string message as the
                        // body content, so use it as the exception message
                        message = body.GetString();
                    }
                    else if (body.ValueType == JsonValueType.Object)
                    {
                        // Get the error message, but default to the status description
                        // below if there's no error message present.
                        message = body.Get("error").AsString() ??
                                  body.Get("description").AsString();
                    }
                }
                
                if (string.IsNullOrWhiteSpace(message))
                {
                    message = string.Format(
                        CultureInfo.InvariantCulture,
                        Resources.MobileServiceClient_ErrorMessage,
                        response.StatusDescription);
                }
            }
            else
            {
                message = string.Format(
                    CultureInfo.InvariantCulture,
                    Resources.MobileServiceClient_ErrorMessage,
                    response.ResponseStatus);
            }

            // Combine the pieces and throw the exception
            throw CreateMobileServiceException(message, request, response);
        }
コード例 #33
0
            public async Task<IServiceFilterResponse> HandleRequest(IServiceFilterRequest request, IServiceFilterContinuation continuation)
            {
                IServiceFilterResponse response = null;
                try
                {
                    for (int i = 0; i < this.NumberOfRequests; i++)
                    {
                        response = await continuation.Handle(request);
                        test.AddLog("Sent the request number {0}", i + 1);
                        test.AddLog("Response: {0} - {1}", response.StatusCode, response.StatusDescription);
                        if (response.StatusCode >= 400)
                        {
                            test.AddLog("Invalid response. Content-Type: {0}", response.ContentType);
                            test.AddLog("Response content: {0}", response.Content);
                            throw new InvalidOperationException();
                        }
                    }
                }
                catch (Exception ex)
                {
                    test.AddLog("Exception while calling continuation: {0}", ex);
                    this.TestFailed = true;
                    throw;
                }

                return response;
            }
コード例 #34
0
 public Task <IServiceFilterResponse> Handle(IServiceFilterRequest request, IServiceFilterContinuation continuation)
 {
     return(Log(request, continuation));
 }
コード例 #35
0
 public Windows.Foundation.IAsyncOperation <IServiceFilterResponse> Handle(IServiceFilterRequest request,
                                                                           IServiceFilterContinuation continuation)
 {
     return(HandleAsync(request, continuation).AsAsyncOperation());
 }
コード例 #36
0
        /// <summary>
        /// Throw an exception for an invalid response to a web request.
        /// </summary>
        /// <param name="request">The request.</param>
        /// <param name="response">The response.</param>
        /// <param name="body">The body of the response as JSON.</param>
        private static void ThrowInvalidResponse(IServiceFilterRequest request, IServiceFilterResponse response, IJsonValue body)
        {
            Debug.Assert(request != null, "request cannot be null!");
            Debug.Assert(response != null, "response cannot be null!");
            Debug.Assert(
                response.ResponseStatus != ServiceFilterResponseStatus.Success ||
                    response.StatusCode >= 400,
                "response should be failing!");

            // Create either an invalid response or connection failed message
            // (check the status code first because some status codes will
            // set a protocol ErrorStatus).
            string message = null;
            if (response.StatusCode >= 400)
            {
                // Get the error message, but default to the status message
                // if there's no error message present.
                string error =
                    body.Get("error").AsString() ??
                    body.Get("description").AsString() ??
                    response.StatusDescription;

                // Get the status code, text
                int code = body.Get("code").AsInteger() ?? response.StatusCode;

                // Combine the pieces and throw the exception
                message =
                    string.Format(CultureInfo.InvariantCulture,
                        Resources.MobileServiceClient_ThrowInvalidResponse_ErrorMessage,
                        code,
                        (HttpStatusCode)code,
                        error,
                        response.Content);
            }
            else
            {                
                message = string.Format(
                    CultureInfo.InvariantCulture,
                    Resources.MobileServiceClient_ThrowConnectionFailure_ErrorMessage,
                    response.ResponseStatus);
            }
            
            // Combine the pieces and throw the exception
            throw CreateMobileServiceException(message, request, response);
        }
 /// <summary>
 /// Initializes a new instance of the
 /// MobileServiceInvalidOperationException class.
 /// </summary>
 /// <param name="message">The exception message.</param>
 /// <param name="request">The originating service request.</param>
 /// <param name="response">The returned service response.</param>
 internal MobileServiceInvalidOperationException(string message, IServiceFilterRequest request, IServiceFilterResponse response)
     : base(message)
 {
     this.Request  = request;
     this.Response = response;
 }
コード例 #38
0
 public IAsyncOperation <IServiceFilterResponse> Handle(IServiceFilterRequest request, IServiceFilterContinuation continuation)
 {
     return(Log(request, continuation).AsAsyncOperation());
 }
コード例 #39
0
 public Task<IServiceFilterResponse> Handle(IServiceFilterRequest request, IServiceFilterContinuation continuation)
 {
     return Log(request, continuation);
 }
コード例 #40
0
 public IAsyncOperation <IServiceFilterResponse> Handle(IServiceFilterRequest request, IServiceFilterContinuation continuation)
 {
     Request = request;
     return(Task.FromResult <IServiceFilterResponse>(Response).AsAsyncOperation());
 }
 /// <summary>
 /// Initializes a new instance of the
 /// MobileServiceInvalidOperationException class.
 /// </summary>
 /// <param name="message">The exception message.</param>
 /// <param name="request">The originating service request.</param>
 /// <param name="response">The returned service response.</param>
 internal MobileServiceInvalidOperationException(string message, IServiceFilterRequest request, IServiceFilterResponse response)
     : base(message)
 {
     this.Request = request;
     this.Response = response;
 }
コード例 #42
0
 public Windows.Foundation.IAsyncOperation<IServiceFilterResponse> Handle(IServiceFilterRequest request,
     IServiceFilterContinuation continuation)
 {
     return HandleAsync(request, continuation).AsAsyncOperation();
 }
コード例 #43
0
 public IAsyncOperation <IServiceFilterResponse> Handle(IServiceFilterRequest request, IServiceFilterContinuation continuation)
 {
     throw new NotImplementedException();
 }
コード例 #44
0
 public IAsyncOperation<IServiceFilterResponse> Handle(IServiceFilterRequest request, IServiceFilterContinuation continuation)
 {
     TaskCompletionSource<IServiceFilterResponse> tcs = new TaskCompletionSource<IServiceFilterResponse>();
     tcs.SetResult(new MyResponse(this.statusCode, this.statusDescription, this.contentType, this.content));
     return tcs.Task.AsAsyncOperation();
 }
コード例 #45
0
 public IAsyncOperation<IServiceFilterResponse> Handle(IServiceFilterRequest request, IServiceFilterContinuation continuation)
 {
     throw new NotImplementedException();
 }