For a deeper look into our DataScope Select SOAP API, look into:

Overview |  Quickstart |  Documentation |  Downloads |  Tutorials

question

Upvotes
Accepted
1 0 0 2

What is the difference between EventContext.Extract and EventContext.ExtractAsynch in DSS REST API using CSharp

What is the difference between EventContext.Extract and EventContext.ExtractAsynch in DSS REST API using Csharp as Extract is taking lot of time even for Single Ric while Extracting Terms and Conditions report.

dss-rest-apidatascope-selectdss
icon clock
10 |1500

Up to 2 attachments (including images) can be used with a maximum of 5.0 MiB each and 10.0 MiB total.

Upvote
Accepted
38.1k 69 35 53

Refer to their signatures, Extract returns IDssEnumerable<ExtractionRow> while ExtractAsync returns Task<IDssEnumerable<ExtractionRow>>.

public IDssEnumerable<ExtractionRow> Extract(ExtractionRequestBase extractionRequest);      

public Task<IDssEnumerable<ExtractionRow>> ExtractAsync(ExtractionRequestBase extractionRequest, CancellationToken cancellationToken = null, IProgress<HttpAsyncStatus> progress = null);
    

The Extract method is synchronous so the call will be block until the extraction is complete.

On the other hand, the ExtractAsync method is asynchronous. It will return immediately without blocking. Therefore, the calling thread is free to perform other jobs and the extraction will be performed by another thread in a thread pool.

To get a result from a task, the Task.Result property can be used. Moreover, Task.IsCompleted property can also be used to verify whether this Task has completed.

For more information about Task<TResult>, please refer to this MSDN documentation.

icon clock
10 |1500

Up to 2 attachments (including images) can be used with a maximum of 5.0 MiB each and 10.0 MiB total.

Upvotes
465 3 5 3

The Async suffix is a standard pattern for .Net Async Programming model. See this page also.

icon clock
10 |1500

Up to 2 attachments (including images) can be used with a maximum of 5.0 MiB each and 10.0 MiB total.

Click below to post an Idea Post Idea