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

Overview |  Quickstart |  Documentation |  Downloads |  Tutorials

question

Upvotes
Accepted
1 0 1 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 512.0 KiB each and 1.0 MiB total.

Hi @tirthesh.khicha

Thank you for your participation in the forum. Is the reply below satisfactory in resolving your query?

If so please can you click the 'Accept' text next to the appropriate reply. This will guide all community members who have a similar question.

Thanks,

AHS

@tirthesh.khicha

Please be informed that a reply has been verified as correct in answering the question, and has been marked as such.

Thanks,

AHS

Upvote
Accepted
78.8k 250 52 74

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 512.0 KiB each and 1.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 512.0 KiB each and 1.0 MiB total.

Write an Answer

Hint: Notify or tag a user in this post by typing @username.

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