Skip to main content

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

Required fields*

11
  • As far as I know you will have to null the child objects. Commented Aug 22, 2014 at 6:48
  • Hi Johan. Doesn't work. It throws errors if I null the collection. Depending on how I do it, it complains about keys being null or that I collection has been modified. Obviously, those things are true, but I did that on purpose so it would leave alone the objects it's not supposed to touch. Commented Aug 22, 2014 at 6:51
  • Euphoric, that is completely unhelpful. Commented Aug 22, 2014 at 6:51
  • 2
    C'mon guys, there must be some way to make EF behave sensibly. I've tried combinations of detaching child entities, cloning the main and creating new database connections, yet EF somehow hangs on to all its junk and complains. There must be some way to completely purge EF and force it to look only at what I give it. At this rate, I'm going to have to build my own set of objects and write SQL/linq to do the inserts I need, which is a huge step backwards. Commented Aug 22, 2014 at 8:39
  • 1
    @MarkyMark, this is EF behaving as EF is intended. It is behaving entirely responsibly. It sounds like you are trying to bend the framework into achieving your own unique objectives, in that situation a framework is not always the best way to go? You wouldn't use a hammer when you really needed a wrench would you. Commented Aug 22, 2014 at 9:04