public async Task <WcfResponse> Create(CriteriaRequest request) #endif { var result = new WcfResponse(); try { request = ConvertRequest(request); // unpack criteria data into object object criteria = GetCriteria(request.CriteriaData); if (criteria is Csla.DataPortalClient.PrimitiveCriteria) { criteria = ((Csla.DataPortalClient.PrimitiveCriteria)criteria).Value; } var processor = new MobileRequestProcessor(); var createRequest = new MobileCriteriaRequest( request.TypeName, criteria, (IPrincipal)MobileFormatter.Deserialize(request.Principal), (ContextDictionary)MobileFormatter.Deserialize(request.GlobalContext), (ContextDictionary)MobileFormatter.Deserialize(request.ClientContext), request.ClientCulture, request.ClientUICulture); #if NET40 var createResponse = processor.Create(createRequest); #else var createResponse = await processor.Create(createRequest).ConfigureAwait(false); #endif if (createResponse.Error != null) { result.ErrorData = new WcfErrorInfo(createResponse.Error); } result.GlobalContext = MobileFormatter.Serialize(createResponse.GlobalContext); result.ObjectData = MobileFormatter.Serialize(createResponse.Object); } catch (Exception ex) { result.ErrorData = new WcfErrorInfo(ex); } finally { MobileRequestProcessor.ClearContext(); } return(ConvertResponse(result)); }
public async Task<WcfResponse> Create(CriteriaRequest request) #endif { var result = new WcfResponse(); try { request = ConvertRequest(request); // unpack criteria data into object object criteria = GetCriteria(request.CriteriaData); if (criteria is Csla.DataPortalClient.PrimitiveCriteria) { criteria = ((Csla.DataPortalClient.PrimitiveCriteria)criteria).Value; } var processor = new MobileRequestProcessor(); var createRequest = new MobileCriteriaRequest( request.TypeName, criteria, (IPrincipal)MobileFormatter.Deserialize(request.Principal), (ContextDictionary)MobileFormatter.Deserialize(request.GlobalContext), (ContextDictionary)MobileFormatter.Deserialize(request.ClientContext), request.ClientCulture, request.ClientUICulture); #if NET40 var createResponse = processor.Create(createRequest); #else var createResponse = await processor.Create(createRequest).ConfigureAwait(false); #endif if (createResponse.Error != null) { result.ErrorData = new WcfErrorInfo(createResponse.Error); } result.GlobalContext = MobileFormatter.Serialize(createResponse.GlobalContext); result.ObjectData = MobileFormatter.Serialize(createResponse.Object); } catch (Exception ex) { result.ErrorData = new WcfErrorInfo(ex); } finally { MobileRequestProcessor.ClearContext(); } return ConvertResponse(result); }
public WcfResponse Fetch(CriteriaRequest request) { var result = new WcfResponse(); try { request = ConvertRequest(request); // unpack criteria data into object object criteria = GetCriteria(request.CriteriaData); if (criteria is Csla.DataPortalClient.PrimitiveCriteria) { criteria = ((Csla.DataPortalClient.PrimitiveCriteria)criteria).Value; } var processor = new MobileRequestProcessor(); var fetchRequest = new MobileCriteriaRequest( request.TypeName, criteria, (IPrincipal)MobileFormatter.Deserialize(request.Principal), (ContextDictionary)MobileFormatter.Deserialize(request.GlobalContext), (ContextDictionary)MobileFormatter.Deserialize(request.ClientContext), request.ClientCulture, request.ClientUICulture); var fetchResponse = processor.Fetch(fetchRequest); if (fetchResponse.Error != null) { result.ErrorData = new WcfErrorInfo(fetchResponse.Error); } result.GlobalContext = MobileFormatter.Serialize(fetchResponse.GlobalContext); result.ObjectData = MobileFormatter.Serialize(fetchResponse.Object); } catch (Exception ex) { result.ErrorData = new WcfErrorInfo(ex); } finally { MobileRequestProcessor.ClearContext(); } return(ConvertResponse(result)); }
public WcfResponse Fetch(CriteriaRequest request) { var result = new WcfResponse(); try { request = ConvertRequest(request); // unpack criteria data into object object criteria = GetCriteria(request.CriteriaData); if (criteria is Csla.DataPortalClient.PrimitiveCriteria) { criteria = ((Csla.DataPortalClient.PrimitiveCriteria)criteria).Value; } var processor = new MobileRequestProcessor(); var fetchRequest = new MobileCriteriaRequest( request.TypeName, criteria, (IPrincipal)MobileFormatter.Deserialize(request.Principal), (ContextDictionary)MobileFormatter.Deserialize(request.GlobalContext), (ContextDictionary)MobileFormatter.Deserialize(request.ClientContext), request.ClientCulture, request.ClientUICulture); var fetchResponse = processor.Fetch(fetchRequest); if (fetchResponse.Error != null) { result.ErrorData = new WcfErrorInfo(fetchResponse.Error); } result.GlobalContext = MobileFormatter.Serialize(fetchResponse.GlobalContext); result.ObjectData = MobileFormatter.Serialize(fetchResponse.Object); } catch (Exception ex) { result.ErrorData = new WcfErrorInfo(ex); } finally { MobileRequestProcessor.ClearContext(); } return ConvertResponse(result); }
public WcfResponse Fetch(CriteriaRequest request)
public WcfResponse Create(CriteriaRequest request)
/// <summary> /// Override to convert the request data before it /// is transferred over the network. /// </summary> /// <param name="request">Request object.</param> protected virtual CriteriaRequest ConvertRequest(CriteriaRequest request) { return request; }
public WcfResponse Delete(CriteriaRequest request)
/// <summary> /// Override to convert the request data before it /// is transferred over the network. /// </summary> /// <param name="request">Request object.</param> protected virtual CriteriaRequest ConvertRequest(CriteriaRequest request) { return(request); }