You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
public async Task BulkNotWorking()
{
var data = new List<Scenario>()
{
new Scenario { Id = -3, Name = "test1", PeriodYear = 2023, },
new Scenario { Id = -4, Name = "test1", PeriodYear = 2023, },
};
var query = @"insert into XXDM.ST_SCENARIO (ID, NAME, PERIOD_YEAR)
values (:ID, :NAME, :PERIOD_YEAR)";
var mapping = new BulkMapping<Scenario>[]
{
new BulkMapping<Scenario>("ID", x => x.Id.Value),
new BulkMapping<Scenario>("NAME", x => x.Name),
new BulkMapping<Scenario>("PERIOD_YEAR", x => x.PeriodYear),
};
using var connection = client.GetConnection();
await connection.SqlBulkAsync(query, data, mapping).ConfigureAwait(false);
}
If I add appropriate OracleMappingType.xxxx to each of the mappings, like this, it works:
new BulkMapping("ID", x => x.Id.Value, OracleMappingType.Int32),
The exception is:
System.ArgumentException: Value does not fall within the expected range.
Stack Trace:
OracleParameter.set_Value(Object value)
OracleDynamicParameters.AddParameters(IDbCommand command, Identity identity)
IDynamicParameters.AddParameters(IDbCommand command, Identity identity)
<>c__DisplayClass165_0.b__0(IDbCommand cmd, Object obj) line 1738
CommandDefinition.SetupCommand(IDbConnection cnn, Action2 paramReader) line 128 SqlMapper.TrySetupAsyncCommand(CommandDefinition command, IDbConnection cnn, Action2 paramReader) line 396
SqlMapper.ExecuteImplAsync(IDbConnection cnn, CommandDefinition command, Object param) line 642
BulkOperation.SqlBulkAsync[T](IDbConnection connection, String sql, IEnumerable1 objects, IEnumerable1 mapping, Nullable`1 cmdType, IDbTransaction transaction)
OracleScenarioRepository.BulkNotWorking() line 114
BulkTester.TestBulkInsert() line 18
ThreadOperations.ExecuteWithAbortSafety(Action action)
This test case throws an exception.
If I add appropriate OracleMappingType.xxxx to each of the mappings, like this, it works:
The exception is:
Finally, this issue was mentioned in https://github.com/DIPSAS/Dapper.Oracle/issues/49, but no suggestions or resolution was provided.
The text was updated successfully, but these errors were encountered: