Async methods on Sap .Net Connector 3

1k views Asked by At

I'm using SAP .Net Connector 3.0.0.42 in my C# .Net v4.5 applications. So far, I can use it with no problems like this:

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 are IO bound operations I want to make it async, for not blocking the thread while waiting to complete, but the Sap .Net Connector doesn't expose any async methods (as far I know).

I read about producing async/await methods and the Task-based async pattern, but to use that I need low level async methods to propagate up, right? For instance, changing 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 it's for CPU bound operations, and using that it'll pick up another thread and block it, so it's not really async. Also, if I develop an asp.net app will take another thread from the pool, isn't it?

So, my question is if it is possible to wrap sync IO bound methods in async ones? I really think I'm missing something here... Thanks!

1

There are 1 answers

0
PotatoJam On BEST ANSWER

It appears that there is no native support within the plugin, but as suggested by Case Ahr here you can do it within your project.