Thanks to visit codestin.com
Credit goes to github.com

Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -706,7 +706,6 @@
</Compile>

<Compile Include="Common\System\NotImplemented.cs" />
<Compile Include="Common\System\Threading\Tasks\TaskToApm.cs" />
<Compile Include="Microsoft\Data\Common\DbConnectionOptions.cs" />
<Compile Include="Microsoft\Data\SqlClient\SNI\ConcurrentQueueSemaphore.cs" />
<Compile Include="Microsoft\Data\SqlClient\SNI\SNIError.cs" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,14 @@

using System;
using System.Diagnostics;
using System.IO;
using System.Threading;
using System.Threading.Tasks;
using Microsoft.Data.Common;

namespace Microsoft.Data.SqlClient
{
sealed internal class SqlSequentialStream : System.IO.Stream
internal sealed class SqlSequentialStream : Stream
{
private SqlDataReader _reader; // The SqlDataReader that we are reading data from
private readonly int _columnIndex; // The index of out column in the table
Expand Down Expand Up @@ -302,7 +303,7 @@ public override IAsyncResult BeginRead(byte[] buffer, int offset, int count, Asy
Task readTask = ReadAsync(buffer, offset, count, CancellationToken.None);
if (callback != null)
{
readTask.ContinueWith((t) => callback(t), TaskScheduler.Default);
readTask.ContinueWith(t => callback(t), TaskScheduler.Default);
}
return readTask;
}
Expand All @@ -328,11 +329,19 @@ public override int EndRead(IAsyncResult asyncResult)
return readTask.Result;
}
#else
public override IAsyncResult BeginRead(byte[] array, int offset, int count, AsyncCallback asyncCallback, object asyncState) =>
TaskToApm.Begin(ReadAsync(array, offset, count, CancellationToken.None), asyncCallback, asyncState);
public override IAsyncResult BeginRead(
byte[] array,
int offset,
int count,
AsyncCallback asyncCallback,
object asyncState)
{
Task<int> readTask = ReadAsync(array, offset, count, CancellationToken.None);
return TaskToAsyncResult.Begin(readTask, asyncCallback, asyncState);
}

public override int EndRead(IAsyncResult asyncResult) =>
TaskToApm.End<int>(asyncResult);
TaskToAsyncResult.End<int>(asyncResult);
#endif
}
}
Loading