26ff8d9b4f
Set up repository with legacy .NET Framework 4.8 source (OLD/), new .NET 10 Blazor solution (NEW/), OpenSpec specifications, documentation, and project configuration.
35 lines
1.2 KiB
C#
35 lines
1.2 KiB
C#
using System.Data;
|
|
using JdeScoping.DataSync.Generated;
|
|
|
|
namespace JdeScoping.DataSync.IntegrationTests.Infrastructure;
|
|
|
|
/// <summary>
|
|
/// IDataReader implementation for BulkMergeTestEntity.
|
|
/// </summary>
|
|
public sealed class BulkMergeTestEntityDataReader : AsyncEnumerableDataReader<BulkMergeTestEntity>
|
|
{
|
|
private static readonly string[] _columnNames = ["Id", "Name", "Amount", "LastUpdateDt"];
|
|
private static readonly Type[] _columnTypes = [typeof(int), typeof(string), typeof(decimal), typeof(DateTime)];
|
|
|
|
public BulkMergeTestEntityDataReader(IAsyncEnumerable<BulkMergeTestEntity> source) : base(source) { }
|
|
|
|
protected override string[] ColumnNames => _columnNames;
|
|
|
|
public static IReadOnlyList<string> GetColumnNames() => _columnNames;
|
|
|
|
protected override object GetColumnValue(int ordinal)
|
|
{
|
|
var entity = Current!;
|
|
return ordinal switch
|
|
{
|
|
0 => entity.Id,
|
|
1 => entity.Name,
|
|
2 => entity.Amount ?? (object)DBNull.Value,
|
|
3 => entity.LastUpdateDt,
|
|
_ => throw new IndexOutOfRangeException()
|
|
};
|
|
}
|
|
|
|
protected override Type GetColumnType(int ordinal) => _columnTypes[ordinal];
|
|
}
|