I\'d like to write a bunch of methods querying the Oracle Database in the async/await way. Since ODP.NET seems to support neither awaitable *Async methods nor Begin/EndOpera
I'm using this
public static class TaskHelper
{
public async static Task AsAsync(Func function, TaskCreationOptions taskCreationOptions = TaskCreationOptions.None)
{
return await Task.Factory.StartNew(function, taskCreationOptions);
}
public async static Task AsAsync(Action action, TaskCreationOptions taskCreationOptions = TaskCreationOptions.None)
{
await Task.Factory.StartNew(action, taskCreationOptions);
}
}
Any synchronous function can be made asynchronous and you can await of it.