System.Data.Services.Client.DataServiceContext from synchronous Execute to asynchronous BeginExecute

Viewed 11

A synchronous dinosaur programmer here with a question about moving code from .net Framework to .net Core. When using DataServiceContext we could use the following code:

string ODataQuery = "https://services.odata.org/v4/northwind/northwind.svc/Orders(10248)?$expand=Customer";

Order order = client.Execute<Order>(new Uri(ODataQuery));

But the method Execute ain't supported anymore in .net Core version of DataServiceContext and need to use (I think) the methods BeginExecute and receive the data in de callback function EndExecute. But I don't know how to write code and examined the "helpful" examples of Microsoft who put everything into a console output. Can anyone give me a short example how I could write a piece of code that gives me a Task back so I can wait for the results or another way of getting the results back in the same process thread used to call the BeginExecute?

Best regards and thank you for keeping this dinosaur alive, Rémy Samulski

0 Answers
Related