title: DbContext Transient makes Insert/Add no more working
body: <p>I just set my DbContext Lifetime to <code>Transient</code> to get rid of <code>&quot;A second operation started on this context ...&quot;</code> (I don't know why this error occurred bc I await all async-calls</p>
  <p>But now with Transient DbContext I can't insert a new Entity into my database.
  It just gives me this error:</p>
  <pre><code>MySqlConnector.MySqlException (0x80004005): Duplicate entry '2' for key 'backgrounds.PRIMARY'
  </code></pre>
  <pre><code>public class Character
      {
          public int CharacterId { get; set; }
          public string Name { get; set; } = null!;
          public int RaceId { get; set; }
          public int ClassId { get; set; }
          public int BackgroundId { get; set; }
      }
  </code></pre>
  <hr>
  <p><strong>In detail:</strong></p>
  <p>And on the webpage the user can select a Class, Race and Background (Dungeons &amp; Dragons)</p>
  <p>So firstly I create a new Character object without any properties set. (<code>new Character()</code>)</p>
  <p>After that the User can select a backgriund and I do: <code>Character.Background = SelectedBackground</code></p>
  <p>After the user selected Race, Class and Background I call my Create method of my repository:</p>
  <pre><code>public async Task&lt;TEntity&gt; CreateAsync(TEntity entity){
          _set.Add(entity);
          await _context.SaveChangesAsync();
          return entity;
      }
  </code></pre>
  <p>where <code>TEntity</code> is <code>Character</code> and <code>_set</code> is <code>DbSet&lt;Character&gt;</code></p>
  <p>But this Create method gives me the error above.</p>
  <p>Character and Background table:</p>
  <p><a href="https://i.stack.imgur.com/q4Q9q.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/q4Q9q.png" alt="Character and Background table" /></a></p>