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)); }
/// <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; }
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); }
public WcfResponse Update(UpdateRequest request)
/// <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); }