title: Entity Framework track of inserts before SaveChanges
body: <p>I have the following issue using entity framework. I'm using IOC with my DBContext as instance per request. I want to insert 'Team' objects into my database. In a certain request there is a loop to insert multiple Teams into the database. Before i add it, i check if the team already exists or not. If it doesn't exist, it can be inserted. 
  These inserts happen all in the same context and at the end i save my changes (SaveChanges) Now the following issue occurs:</p>
  
  <p>To get my IdbSet i do the following : <code>_context.Set&lt;TEntity&gt;()</code>
  After an insert of TEntity, the <code>_context.Set&lt;TEntity&gt;()</code> doesn't contain my inserted object.. How can i make sure entity framework tracks my insert during the same scope?</p>
  
  <p>EDIT: 
  <strong>Example</strong>
  First i add my team </p>
  
  <pre><code>_context.Set&lt;Team&gt;().Add(entity);`
  </code></pre>
  
  <p>Then i search for it, but it's not in the list</p>
  
  <pre><code>_context.Set&lt;Team&gt;().Where(p =&gt; p.Name.Equals(name, StringComparison.OrdinalIgnoreCase)).FirstOrDefault();
  </code></pre>