There really isn’t very much for me to say about updating and editing entities. Changing a property is changing a property. As for deleting? Well, you need to call a different method depending on which API you’re using (
DbSet<T>.Remove()), and I’ve already told you that the entities aren’t actually deleted until after the database is updated by a call to
But there is one thig we haven’t discussed: What happens to an entity when an entity it is related to is removed from the database? Let’s look at how that works:
It all depends on the nullability of the foreign key. That determines whether the relationship is optional or required. If the foreign key can be null, the relationship ...