示例#1
0
        public async Task <WcfResponse> Update(UpdateRequest request)
#endif
        {
            var result = new WcfResponse();

            try
            {
                request = ConvertRequest(request);
                // unpack object
                object obj = GetCriteria(request.ObjectData);

                var processor     = new MobileRequestProcessor();
                var updateRequest = new MobileUpdateRequest(
                    obj,
                    (IPrincipal)MobileFormatter.Deserialize(request.Principal),
                    (ContextDictionary)MobileFormatter.Deserialize(request.GlobalContext),
                    (ContextDictionary)MobileFormatter.Deserialize(request.ClientContext),
                    request.ClientCulture,
                    request.ClientUICulture);

#if NET40
                var updateResponse = processor.Update(updateRequest);
#else
                var updateResponse = await processor.Update(updateRequest).ConfigureAwait(false);
#endif
                if (updateResponse.Error != null)
                {
                    result.ErrorData = new WcfErrorInfo(updateResponse.Error);
                }
                result.GlobalContext = MobileFormatter.Serialize(updateResponse.GlobalContext);
                result.ObjectData    = MobileFormatter.Serialize(updateResponse.Object);
            }
            catch (Exception ex)
            {
                result.ErrorData = new WcfErrorInfo(ex);
            }
            finally
            {
                MobileRequestProcessor.ClearContext();
            }
            return(ConvertResponse(result));
        }
示例#2
0
 /// <summary>
 /// Override to convert the request data before it
 /// is transferred over the network.
 /// </summary>
 /// <param name="request">Request object.</param>
 protected virtual UpdateRequest ConvertRequest(UpdateRequest request)
 {
   return request;
 }
示例#3
0
    public async Task<WcfResponse> Update(UpdateRequest request)
#endif
    {
      var result = new WcfResponse();
      try
      {
        request = ConvertRequest(request);
        // unpack object
        object obj = GetCriteria(request.ObjectData);

        var processor = new MobileRequestProcessor();
        var updateRequest = new MobileUpdateRequest(
          obj,
          (IPrincipal)MobileFormatter.Deserialize(request.Principal),
          (ContextDictionary)MobileFormatter.Deserialize(request.GlobalContext),
          (ContextDictionary)MobileFormatter.Deserialize(request.ClientContext),
          request.ClientCulture,
          request.ClientUICulture);

#if NET40
        var updateResponse = processor.Update(updateRequest);
#else
        var updateResponse = await processor.Update(updateRequest).ConfigureAwait(false);
#endif
        if (updateResponse.Error != null)
        {
          result.ErrorData = new WcfErrorInfo(updateResponse.Error);
        }
        result.GlobalContext = MobileFormatter.Serialize(updateResponse.GlobalContext);
        result.ObjectData = MobileFormatter.Serialize(updateResponse.Object);
      }
      catch (Exception ex)
      {
        result.ErrorData = new WcfErrorInfo(ex);
      }
      finally
      {
        MobileRequestProcessor.ClearContext();
      }
      return ConvertResponse(result);
    }
示例#4
0
 public WcfResponse Update(UpdateRequest request)
示例#5
0
 /// <summary>
 /// Override to convert the request data before it
 /// is transferred over the network.
 /// </summary>
 /// <param name="request">Request object.</param>
 protected virtual UpdateRequest ConvertRequest(UpdateRequest request)
 {
     return(request);
 }
示例#6
0
 public WcfResponse Update(UpdateRequest request)