title: Proper way to use dbcontext (Global or pass as parameter?)
body: <p>When I call a method that need <code>dbcontext</code> for <code>update</code> or <code>insert</code>
  but only want one <code>saveChange()</code> like following</p>
  
  <p><strong>Action: Login</strong></p>
  
  <pre><code>        TempDBEntity context = new TempDBEntity();
          var temp = context.Users.Where(m =&gt; m.user_unique_id == 1).FirstOrDefault();
          temp.timestamp = new DateTime();
          temp.AddLog("Login");
          context.SaveChanges();
  </code></pre>
  
  <p><strong>Function: AddLog</strong></p>
  
  <pre><code>public void AddLog(string activity){
          TempDBEntity context2 = new TempDBEntity();
          var log = new UserLog();
          log.user_id = this.user_id;
          log.activity = activity;
          context2.UserLog.Add(log);
          context2.SaveChanges();
   }
  </code></pre>
  
  <p>As you can see, there is double <code>SaveChanges()</code> which I only need 1 <code>SaveChanges()</code>.</p>
  
  <p>Should I pass <code>DBContext</code> as another parameter for <code>AddLog()</code>
  or should I declare static variable for <code>dbcontext</code>in this case?</p>
  
  <p>Thanks a lot.</p>