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
when remove Non-existent entity EF Core will throw Database operation expected to affect 1 row(s) but actually affected 0 row(s) exception. in the Source code i find the Method:
protected virtual int ConsumeResultSetWithoutPropagation(int commandIndex, [NotNull] RelationalDataReader reader)
{
var expectedRowsAffected = 1;
while (++commandIndex < CommandResultSet.Count
&& CommandResultSet[commandIndex - 1] == ResultSetMapping.NotLastInResultSet)
{
Debug.Assert(!ModificationCommands[commandIndex].RequiresResultPropagation);
expectedRowsAffected++;
}
if (reader.Read())
{
var rowsAffected = reader.DbDataReader.GetInt32(0);
if (rowsAffected != expectedRowsAffected)
{
ThrowAggregateUpdateConcurrencyException(commandIndex, expectedRowsAffected, rowsAffected);
}
}
else
{
ThrowAggregateUpdateConcurrencyException(commandIndex, 1, 0);
}
return commandIndex;
}
in the method if rowsAffected != expectedRowsAffected it will throw ThrowAggregateUpdateConcurrencyException. I want to know why must throw exception when rowsAffected != expectedRowsAffected. some time i don't care remove result ,but because of the exception i must Handle the remove result,otherwise my application can't runing.
The text was updated successfully, but these errors were encountered:
when remove Non-existent entity EF Core will throw Database operation expected to affect 1 row(s) but actually affected 0 row(s) exception. in the Source code i find the Method:
in the method if rowsAffected != expectedRowsAffected it will throw ThrowAggregateUpdateConcurrencyException. I want to know why must throw exception when rowsAffected != expectedRowsAffected. some time i don't care remove result ,but because of the exception i must Handle the remove result,otherwise my application can't runing.
The text was updated successfully, but these errors were encountered: