Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>The order inserts/updates and deletes are made in the Entity Framework is dependent upon many things in the Entity Framework.</p> <p>For example if you insert a new Product in a new Category we have to add the Category before the Product.</p> <p>This means that if you have a large set of changes there are local ordering constraints that we must satisfy first, and indeed this is what we do.</p> <p>The order that you do things on the context can be in conflict with these rules. For example if you do this:</p> <pre><code>ctx.AddToProducts( new Product{ Name = "Bovril", Category = new Category {Name = "Food"} } ); </code></pre> <p>the effect is that the Product is added (to the context) first and then when we walk the graph we add the Category too.</p> <p>i.e. the insert order into the context is: </p> <pre><code>Product Category </code></pre> <p>but because of referential integrity constraints we must re-order like this before attempting to insert into the database:</p> <pre><code>Category Product </code></pre> <p>So this kind of local re-ordering is kind of non-negotiable.</p> <p>However if there are no local dependencies like this, you could in theory preserve ordering. Unfortunately we don't currently track 'when' something was added to the context, and for efficiency reason we don't track entities in order preserving structures like lists. As a result we can't currently preserve the order of unrelated inserts.</p> <p>However we were debating this just recently, so I am keen to see just how vital this is to you?</p> <p>Hope this helps</p> <p>Alex</p> <p>Program Manager Entity Framework Team</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload