Hi,
I am using a many-to-one relationship to model a linked list in my database. See subjoined code snippet.
Code:
public class Instruction
{
...
[ManyToOne(Column = "NextInstructionId")]
public virtual Instruction Next { get; set; }
....
}
Now, create a linked list of instruction works fine. The last instruction get a NULL value in the NextInstructionId column. But, when I remove the last instruction from my list, then the previous one becomes last. So, I set the Next property to null. But, on update, the database engine complains that the foreign key constraint is not met, because NextInstructionId is null.
Does anyone know what might happen here?
Thanks,
Alexander.