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
{{ message }}
Repository navigation
Owned entities FKs not matching PK casing on creation #37023
When adding a new entity without autogenerated keys to the DB and then changing the key before saving to uppercase FKs for owned entities (didn't test it with non-owned entities) stay lowercase.
This does not happen if the key gets changed completely to a different value, then the owned entities are updated accordingly.
Your code
varentity=newMyEntity{Key="test",...MyOwnedCollection=[...]};db.Add(entity);entity.Key=entity.Key.ToUpper();db.SaveChanges();// entity gets inserted with PK Key = "TEST", while the owned entities with FK MyEntityKey = "test"
Activity
Xriuk commentedon Oct 24, 2025
Not sure if related to #32898
Also I understand that by default it seems that case-insensitive comparison is used for SQL server keys but still imho EF Core should be consistent at least when inserting keys into the DB.
Propagate case-only principal string key updates to dependent FKs (#3…