I have 2 tables:
orders
orderItems
connected to one another threw a relationship(FK orderId in the orderItems table). is there a difference between:
order.orderitems.remove(...)
to just setting the orderId value to null when trying to remove the related entity?
Setting the FK property to null and removing the entity from the navugation property both do the same thing. That is, they both sever the relationship between the entities but do not cause either entity to be deleted. It’s the same as setting the FK value in the database to NULL.
To delete the entity you must call Remove on the DbSet for the entity. For example