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
Recently when updating from EF Core 3.0 to EF Core 7.0 we discovered a bug that ended up setting millions for foreign key values to NULL. We discovered that a previously supported strategy of disabling the reverse foreign key collections is no longer supported but does not return a runtime error, which it should. Below is the code that set all the foreign keys to NULL.
Your code
varfirearm=_dbContext.Firearms.Include(x =>x.MakeNav).First(x =>x.Id==1);firearm.FirStatId=1;await_dbContext.SaveChangesAsync(cancellationToken);// This set all the Makes to NULLThis was the strategy we previously used (.Net3.0)todisable the reverse foreign key collections.
entity.HasOne(d=>d.MakeNav).WithOne().HasForeignKey<Firearms>(d =>d.MakeCode).HasConstraintName("FIREARM_FIREARM_MAKE_FK");
Stack traces
Verbose output
EF Core version
7.0.0
Database provider
Oracle.EntityFrameworkCore
Target framework
.NET 8
Operating system
No response
IDE
No response
The text was updated successfully, but these errors were encountered:
Bug description
Hi Team,
Recently when updating from EF Core 3.0 to EF Core 7.0 we discovered a bug that ended up setting millions for foreign key values to NULL. We discovered that a previously supported strategy of disabling the reverse foreign key collections is no longer supported but does not return a runtime error, which it should. Below is the code that set all the foreign keys to NULL.
Your code
Stack traces
Verbose output
EF Core version
7.0.0
Database provider
Oracle.EntityFrameworkCore
Target framework
.NET 8
Operating system
No response
IDE
No response
The text was updated successfully, but these errors were encountered: