-
Notifications
You must be signed in to change notification settings - Fork 3.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Regression] Insertion order is wrong when owned entity is involved #23668
Comments
I'm sorry but this is so frustrating. With every release, EF Core has so many regressions and breaking changes while .NET Core itself and also ASP.NET Core are much more stable now. I test my app on EF Core 5 and report bugs that prevent me from testing any further, Some get fixed in preview releases, some in RTM and others in 5.0.1, only for me to then try again and run into other bugs or breaking changes. It is so incredibly difficult to upgrade to a new EF Core version every time 😞 From the outside, it just seems like EF Core must have very poor test coverage with only basic cases covered with so many regressions. Maybe this will get fixed for owned entity types. But what about other interesting scenarios. TPH inheritance or TPT inheritance? Do they work or do they have no test coverage either? 😕 Especially issues like #23401, which made owned entities completely unusable if their owner has a PK composed of more than 1 property, really surprise me - it's such a basic scenario. How did this creep into the final release? Sometimes I feel like I'm the only one actually using EF Core for anything serious 😟 Sorry for being so unpleasant but it's just so tiring at this point finding so many regressions with every release. I just hope this is going to get better in the future |
I'm guessing the problem is somewhere in I got a workaround by overriding class CustomCommandBatchPreparer : CommandBatchPreparer
{
public CustomCommandBatchPreparer(CommandBatchPreparerDependencies dependencies) : base(dependencies)
{
}
protected override IReadOnlyList<List<ModificationCommand>> TopologicalSort(IEnumerable<ModificationCommand> commands)
{
var result = base.TopologicalSort(commands);
var commandsToPrepend = new List<ModificationCommand>();
foreach (var modificationList in result)
{
for (int i = modificationList.Count - 1; i >= 0; --i)
{
var modification = modificationList[i];
if (modification is { TableName: "FileMetadata", EntityState: EntityState.Added })
{
modificationList.RemoveAt(i);
commandsToPrepend.Add(modification);
}
}
}
if (commandsToPrepend.Count > 0)
((List<List<ModificationCommand>>)result).Insert(0, commandsToPrepend);
return result;
}
} |
…te for entities using table splitting. Fixes #23668
Steps to reproduce
This seems to be a regression because it worked properly in EF Core 3.1 - downgrading the Microsoft.EntityFrameworkCore.SqlServer package makes this work. Is there any workaround for this (other than adding one more roundtrip to the database to make sure that
FileMetadata
is inserted first)?Include provider and version information
EF Core version: 5.0.1
Database provider: Microsoft.EntityFrameworkCore.SqlServer
Target framework: .NET 5.0
Operating system: Windows 10 Version 1909
IDE: Visual Studio 16.9.0 Preview 2.0
The text was updated successfully, but these errors were encountered: