orientechnologies / OrientDB.Net

OrientDB .Net Core core modules solution.
4 stars 7 forks source link

Feature Request: Async Queries #12

Open gar-ema opened 7 years ago

gar-ema commented 7 years ago

From @DavidParks8 on June 10, 2017 15:58

I would like to have support for async queries (using async and await with tasks).

Copied from original issue: orientechnologies/OrientDB.Net.Core#6

gar-ema commented 7 years ago

From @realityenigma on June 13, 2017 3:18

I will investigate adding support. Thank you for the recommendation!

gar-ema commented 7 years ago

From @alzuma on August 11, 2017 19:15

this is doable, it all starts in "OrientDBBinaryConnectionStream.cs"

private void Send(byte[] buffer, NetworkStream stream)
{
    if ((stream != null) && stream.CanWrite)
    {
        try
        {
            stream.Write(buffer, 0, buffer.Length);
        }
        catch (Exception ex)
        {
            throw new Exception(ex.Message, ex.InnerException);
        }
    }
}

add async one

private async Task SendAsync(byte[] buffer, NetworkStream stream)
{
    if (stream != null && stream.CanWrite)
    {
        await stream.WriteAsync(buffer, 0, buffer.Length);
    }
}

and then few more places up the stream.

Need help with this?

gar-ema commented 7 years ago

From @realityenigma on August 16, 2017 23:4

I definitely open to help and would welcome it.