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
I cannot re-produce this consistently, but I have gotten the following error when using this plugin:
The operation failed: The relationship could not be changed because one or more of the foreign-key properties is non-nullable. When a change is made to a relationship, the related foreign-key property is set to a null value. If the foreign-key does not support null values, a new relationship must be defined, the foreign-key property must be assigned another non-null value, or the unrelated object must be deleted.
I was under the impression it had to do with my entities (See SO Question); however when disabling this plugin the issue is gone.
The text was updated successfully, but these errors were encountered:
MyTable : ID int, DummyId int FK
DummyTable : ID int
MyTableEntity class :
public int ID { get; set; }
public DummyEntity Dummy { get; set; }
public int DummyId { get; set; }
Scenario :
If with a Mapper like AutoMapper you set Dummy property as NULL and you change or keep value for DummyId
IdentityDbContext save without problem the object (of course DummyId must exist in Dummy Table)
TrackerIdentityContext fail with message :
The operation failed: The relationship could not be changed because one or more of the foreign-key properties is non-nullable. When a change is made to a relationship, the related foreign-key property is set to a null value. If the foreign-key does not support null values, a new relationship must be defined, the foreign-key property must be assigned another non-null value, or the unrelated object must be deleted.
Workaround/good practice :
Prevent editing Reference property, with AutoMapper :
.ForMember(x => x.Dummy, o => o.Ignore())
Or/And don't expose Reference property on ViewModel ...
I cannot re-produce this consistently, but I have gotten the following error when using this plugin:
I was under the impression it had to do with my entities (See SO Question); however when disabling this plugin the issue is gone.
The text was updated successfully, but these errors were encountered: