internal override Task <ODataBatchReader> CreateBatchReaderAsync(string batchBoundary) { return(TaskUtils.GetTaskForSynchronousOperation <ODataBatchReader>(() => this.CreateBatchReaderImplementation(batchBoundary, false))); }
internal override Task <object> ReadValueAsync(IEdmPrimitiveTypeReference expectedPrimitiveTypeReference) { return(TaskUtils.GetTaskForSynchronousOperation <object>(() => this.ReadValueImplementation(expectedPrimitiveTypeReference))); }
internal override Task <IEnumerable <ODataPayloadKind> > DetectPayloadKindAsync(IODataRequestMessageAsync requestMessage, ODataPayloadKindDetectionInfo detectionInfo) { ExceptionUtils.CheckArgumentNotNull <IODataRequestMessageAsync>(requestMessage, "requestMessage"); ExceptionUtils.CheckArgumentNotNull <ODataPayloadKindDetectionInfo>(detectionInfo, "detectionInfo"); return(TaskUtils.GetCompletedTask <IEnumerable <ODataPayloadKind> >(Enumerable.Empty <ODataPayloadKind>())); }
private Task <bool> ReadAsynchronously() { return(TaskUtils.GetTaskForSynchronousOperation <bool>(new Func <bool>(this.ReadImplementation))); }
internal override Task <IEnumerable <ODataPayloadKind> > DetectPayloadKindAsync(IODataResponseMessageAsync responseMessage, ODataPayloadKindDetectionInfo detectionInfo) { ExceptionUtils.CheckArgumentNotNull <IODataResponseMessageAsync>(responseMessage, "responseMessage"); ExceptionUtils.CheckArgumentNotNull <ODataPayloadKindDetectionInfo>(detectionInfo, "detectionInfo"); return(TaskUtils.GetTaskForSynchronousOperation <IEnumerable <ODataPayloadKind> >(() => DetectPayloadKindImplementation(detectionInfo.ContentType))); }
protected override Task <bool> ReadAsynchronously() { Task <bool> result; switch (this.State) { case ODataReaderState.Start: result = this.ReadAtStartImplementationAsync(); break; case ODataReaderState.FeedStart: result = this.ReadAtFeedStartImplementationAsync(); break; case ODataReaderState.FeedEnd: result = this.ReadAtFeedEndImplementationAsync(); break; case ODataReaderState.EntryStart: result = TaskUtils.GetTaskForSynchronousOperation(() => this.IncreaseEntryDepth()) .FollowOnSuccessWithTask(t => this.ReadAtEntryStartImplementationAsync()); break; case ODataReaderState.EntryEnd: result = TaskUtils.GetTaskForSynchronousOperation(() => this.DecreaseEntryDepth()) .FollowOnSuccessWithTask(t => this.ReadAtEntryEndImplementationAsync()); break; case ODataReaderState.NavigationLinkStart: result = this.ReadAtNavigationLinkStartImplementationAsync(); break; case ODataReaderState.NavigationLinkEnd: result = this.ReadAtNavigationLinkEndImplementationAsync(); break; case ODataReaderState.EntityReferenceLink: result = this.ReadAtEntityReferenceLinkAsync(); break; case ODataReaderState.Exception: // fall through case ODataReaderState.Completed: result = TaskUtils.GetFaultedTask <bool>(new ODataException(Strings.ODataReaderCore_NoReadCallsAllowed(this.State))); break; default: Debug.Assert(false, "Unsupported reader state " + this.State + " detected."); result = TaskUtils.GetFaultedTask <bool>(new ODataException(Strings.General_InternalError(InternalErrorCodes.ODataReaderCoreAsync_ReadAsynchronously))); break; } return(result.FollowOnSuccessWith(t => { if ((this.State == ODataReaderState.EntryStart || this.State == ODataReaderState.EntryEnd) && this.Item != null) { ReaderValidationUtils.ValidateEntry(this.CurrentEntry); } return t.Result; })); }