For a given entity I can get all its references by calling
var references = dbContext.Entry(entity).References;
Now I want to set all references to null.
foreach (var reference in references)
{
reference.CurrentValue = null;
}
context.Update(entity);
context.SaveChanges();
But apparently it is not sufficient to set the reference to null, one must set the foreign key property as well. But how to find the foreign key field for a given reference?