Change ExecuteDynamicSqlAsync to return object list
The ExecuteDynamicSqlAsync method now returns an IEnumerable of dictionaries representing query result rows, instead of a JSON string. This allows consumers to work directly with the data in its native .NET object form.
This commit is contained in:
@@ -30,7 +30,7 @@ public interface IRecDbContext
|
|||||||
public static class RecDbContextSaveExtensions
|
public static class RecDbContextSaveExtensions
|
||||||
{
|
{
|
||||||
//TODO: Once it is finalized, move it to Common.Infrastructure
|
//TODO: Once it is finalized, move it to Common.Infrastructure
|
||||||
public static async Task<string> ExecuteDynamicSqlAsync(this IRecDbContext context, string sql, CancellationToken cancel = default)
|
public static async Task<IEnumerable<Dictionary<string, object?>>> ExecuteDynamicSqlAsync(this IRecDbContext context, string sql, CancellationToken cancel = default)
|
||||||
{
|
{
|
||||||
var result = new List<Dictionary<string, object?>>();
|
var result = new List<Dictionary<string, object?>>();
|
||||||
|
|
||||||
@@ -56,6 +56,6 @@ public static class RecDbContextSaveExtensions
|
|||||||
result.Add(row);
|
result.Add(row);
|
||||||
}
|
}
|
||||||
|
|
||||||
return JsonSerializer.Serialize(result);
|
return result;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Reference in New Issue
Block a user