There are two things going on here. I don't completely understand the relationship between them, but I think I can get you on your way.
The first thing that you need to understand is that the Entity Framework does not deal well with deleting a less-than-fully-materialized instance. That is why Include changes the behavior that you see. So if you have an entity that aggregates a list of children, you need to load those children before calling delete. Only if the child instances are in memory will they be deleted before the parent. So, with or without Include, you need to do something like this before calling Delete.
if (!thing.BrandReference.IsLoaded) thing.BrandReference.Load();
If you've called Include on the relationship, then this will do nothing if you haven't, then it will ensure that everything is materialized before you
The second thing that unique understand is that inserting a new entity with a relationship to an existing entity is conceptually two different inserts. This is a consequence of the fact that relationships are first-class in the Entity Framework. The first insert is the entity itself, the second is the relationship. In this case, there is no separate table for the relationship, so only one actual insert to the database as needed. However, the Entity Framework can only figure this out if it is mapped correctly.
So what is going on in this case? What follows is my speculation based on some of the things I see going on here. But I think the situation is even more complicated than I'm describing, so I believe what follows is incorrect in some of the details. It may be close enough to help you solve the actual problem, though.
- You had an instance that was less-than-fully-materialized before you tried to delete it.
- When you tried to delete something else, the framework tried to look into the same relationship. It found things out of whack and tried, unsuccessfully, to put things back into a good state.
- Then you tried to delete again, 2 repeats, only this time it is even less successful, due to the database constraint.
- Using Include fixes the issue in 1.