Description
When using the InterBaseSql.EntityFrameworkCore.InterBase Version 10.0.2 we are unable to delete an entity.
Removing an entity and calling context.SaveChanges()
always throws an Microsoft.EntityFrameworkCore.DbUpdateConcurrencyException
.
See unit test InterBaseSql.EntityFrameworkCore.InterBase.Tests.EndToEnd.Delete()
as code snippet to reproduce. This test fails.
Calling SaveChanges()
throws the exception within Microsoft.EntityFrameworkCore.Update.AffectedCountModificationCommandBatch::Consume(RelationalDataReader reader)
.
https://github.com/dotnet/efcore/blob/6119066c37b98f604a5c868d691da0405d53e1aa/src/EFCore.Relational/Update/AffectedCountModificationCommandBatch.cs#L121C33-L121C74
The reader
inside has no rows, only the property reader.RecordsAffected == 1
.
See ResultSetMapping == ResultSetMapping.LastInResultSet
where EF tries to get a row which does not exist.
https://github.com/dotnet/efcore/blob/6119066c37b98f604a5c868d691da0405d53e1aa/src/EFCore.Relational/Update/AffectedCountModificationCommandBatch.cs#L62C1-L66C1
IBUpdateSqlGenerator.AppendDeleteOperation()
sets the ResultSetMapping
to ResultSetMapping.LastInResultSet
.
The InterBaseSql.EntityFrameworkCore.InterBase.Update.Internal::AppendUpdateOperation
sets the ResultSetMapping
to ResultSetMapping.NoResults
.
Just to doublecheck, I modified AppendDeleteOperation
to return ResultSetMapping.NoResults
.
=> UnitTest Delete()
passes.
Doing the same im my project and Remove/Delete works as expected.
Problem: Changing this behaviour means there is no UpdateConcurrency check any more (which would be appreciated for AppendUpdateOperation as well).
UnitTest InterBaseSql.EntityFrameworkCore.InterBase.Tests.EndToEnd::ConcurrencyDelete => fail
UnitTest InterBaseSql.EntityFrameworkCore.InterBase.Tests.EndToEnd::Delete => pass
Could you please help us with this issue? Delete functionality is essential.
Thanks and with kind regards,