-
Notifications
You must be signed in to change notification settings - Fork 347
Closed as not planned
Closed as not planned
Copy link
Description
Using EF Core 6.0.8 with Pomelo 6.0.0, when we have the following:
Table - Person
| Id | Name (max 3) |
context.Add<Person>(new Person { Name = "Three" });
context.Add<Person>(new Person { Name = "A" });
context.Add<Person>(new Person { Name = "B" });
context.Add<Person>(new Person { Name = "C" });
try
{
context.SaveChanges();
}
catch (DbUpdateException ex)
{
ex.Entries.Count(); // 4
}
However, when we have it where the first record does not have an error:
context.Add<Person>(new Person { Name = "Three" });
context.Add<Person>(new Person { Name = "A" });
context.Add<Person>(new Person { Name = "Three" });
context.Add<Person>(new Person { Name = "B" });
context.Add<Person>(new Person { Name = "C" });
try
{
context.SaveChanges();
}
catch (DbUpdateException ex)
{
ex.Entries.Count(); // 1
}
Only the one record is in Entries.
We expect this to be consistent and only have the 1 Entry that failed.
The cause of this happening is the InitAsync, which is attempting to read the first result - fails and throws an exception.
| await m_resultSet.ReadResultSetHeaderAsync(ioBehavior).ConfigureAwait(false); |
That exception is caught and EF Core selects all Entries whereas in ConsumeAsync, it only selects the current command Entry.
ExecuteReaderAsync should return a reader, but perhaps shouldn't read anything. Not sure what other implementations are doing though.
Metadata
Metadata
Assignees
Labels
No labels