Update Mongodb

This commit is contained in:
sunkaixuan 2025-05-04 21:33:52 +08:00
parent f45f9975d8
commit 08116a9254
2 changed files with 6 additions and 4 deletions

View File

@ -6,6 +6,7 @@
<ItemGroup>
<PackageReference Include="MongoDB.Driver" Version="3.3.0" />
<PackageReference Include="System.Data.Common" Version="4.3.0" />
</ItemGroup>
</Project>

View File

@ -8,6 +8,7 @@ using MongoDB.Bson.Serialization;
using System.Collections.Generic;
using System.Xml.Linq;
using System.Threading.Tasks;
using System.Threading;
namespace MongoDb.Ado.data
{
@ -78,25 +79,25 @@ namespace MongoDb.Ado.data
return new DbDataReaderFactory().Handle(operation, collection, json);
}
public new Task<int> ExecuteNonQueryAsync()
public override Task<int> ExecuteNonQueryAsync(CancellationToken cancellationToken)
{
var (operation, collectionName, json) = ParseCommand(_commandText);
var collection = GetCollection(collectionName);
return ExecuteHandlerFactoryAsync.HandlerAsync(operation, json, collection);
}
public new Task<object> ExecuteScalarAsync()
public override Task<object> ExecuteScalarAsync(CancellationToken cancellationToken)
{
var (operation, collectionName, json) = ParseCommand(_commandText);
var collection = GetCollection(collectionName);
return new ExecuteScalarHandlerAsync().HandleAsync(operation, collection, json);
}
public new Task<DbDataReader> ExecuteReaderAsync()
public override Task<DbDataReader> ExecuteReaderAsync(CancellationToken cancellationToken)
{
var (operation, collectionName, json) = ParseCommand(_commandText);
var collection = GetCollection(collectionName);
return new DbDataReaderFactoryAsync().HandleAsync(operation, collection, json);
}
protected Task<DbDataReader> ExecuteDbDataReaderAsync(CommandBehavior behavior)
protected override Task<DbDataReader> ExecuteDbDataReaderAsync(CommandBehavior behavior,CancellationToken cancellationToken)
{
return ExecuteReaderAsync();
}