This is an automated email from the ASF dual-hosted git repository. ptupitsyn pushed a commit to branch ignite-22133-bak in repository https://gitbox.apache.org/repos/asf/ignite-3.git
commit ebc5b60b87e1dd07e79e94a33fe246be3a305859 Author: Pavel Tupitsyn <[email protected]> AuthorDate: Fri Jun 27 15:04:23 2025 +0300 ExecuteScalarAsync implemented --- .../DataCommon/IgniteCommand.cs | 23 ++++++++++++++++++++-- 1 file changed, 21 insertions(+), 2 deletions(-) diff --git a/modules/platforms/dotnet/Apache.Ignite.EntityFrameworkCore/DataCommon/IgniteCommand.cs b/modules/platforms/dotnet/Apache.Ignite.EntityFrameworkCore/DataCommon/IgniteCommand.cs index ee52b2cd105..0ee5eb31d82 100644 --- a/modules/platforms/dotnet/Apache.Ignite.EntityFrameworkCore/DataCommon/IgniteCommand.cs +++ b/modules/platforms/dotnet/Apache.Ignite.EntityFrameworkCore/DataCommon/IgniteCommand.cs @@ -78,9 +78,28 @@ public class IgniteCommand : DbCommand return (int)resultSet.AffectedRows; } - public override Task<object> ExecuteScalarAsync(CancellationToken cancellationToken) + public override async Task<object> ExecuteScalarAsync(CancellationToken cancellationToken) { - throw new NotImplementedException(); + var args = GetArgs(); + var statement = GetStatement(); + + // TODO: Remove debug output. + Console.WriteLine($"IgniteCommand.ExecuteScalarAsync [statement={statement}, parameters={string.Join(", ", args)}]"); + + // TODO: Propagate transaction somehow. + await using IResultSet<object> resultSet = await GetSql().ExecuteAsync<object>( + transaction: null, + statement, + cancellationToken, + args); + + await foreach (var row in resultSet) + { + // Return the first result. + return row; + } + + throw new InvalidOperationException("Query returned no results: " + statement); } public override object ExecuteScalar() => ExecuteScalarAsync().GetAwaiter().GetResult();
