Asynchronous Methods for Sap.Net Connector 3
I am using SAP.Net Connector 3.0.0.42 in my C # .Net v4.5 applications. So far I can use it without any problem:
var destination = RfcDestinationManager.GetDestination(destinationName);
var repository = destination.Repository;
var function = repository.CreateFunction(functionName);
function.Invoke(destination);
var resultTable = function.GetTable(tableName); //This can be time consuming
Sometimes there are calls that are time consuming and because they involve IO-related operations, I want to do this async
so as not to block the thread while waiting, but Sap .Net Connector
does not provide any asynchronous methods (as far as I know).
I've read about creating async / await methods and Task Based Asynchronous Pattern , but in order to use I need low level methods async
to propagate upward, right? For example, moving from Thread.Sleep
to Task.Delay
. But what if there are no such methods?
My first thought was to use Task.Run
, but I read that this is for CPU bound operations, and using that, it will pick up another thread and block it, so it is not valid async
. Also, if I develop an asp.net application, you get another thread from the pool, right?
So my question is, is it possible to bind binding methods to an IO method in async
? ... I really think I am missing something ... Thanks!
source to share