title: Is it ok to have one DbContext object for the whole project?
body: <p>I'm working on a c# project which uses Entity Framework 6 for MySql. for Adding objects to the dbContext I use the following approach:</p>
  
  <pre><code>    public void Add(User item)
      {
          using (var ctx = new DbContext())
          {
              ctx.Users.Add(item);
              ctx.SaveChanges();
          }
      }
  </code></pre>
  
  <p>Now I need to know if it is ok to have one DbContext object for instance:</p>
  
  <p>private DbContext _ctx = new DbContext();</p>
  
  <p>and change the Add method to</p>
  
  <pre><code>    public void Add(User item)
      {
          _ctx.Users.Add(item);
          _ctx.SaveChanges();
      }
  </code></pre>
  
  <p>And then to have another method to dispose the DbContext object and call it when the application is quitting.</p>
  
  <p>Is it a good approach? what are the cons and pros of this approach?</p>
  
  <p>thanks in advanced.</p>