title: Entity Framework new transaction is not allowed because there are other threads running in the session, multi thread save
body: <p>I'm tryng to save on a DB the log of a multi thread processo but I'm getting the following error: new transaction is not allowed because there are other threads running in the session.</p>
  
  <p>in each tread I have this function:</p>
  
  <pre><code> internal bool WriteTrace(IResult result, string message, byte type)
      {
          SPC_SENDING_TRACE trace = new SPC_SENDING_TRACE(
                          message,
                          Parent.currentLine.CD_LINE,
                          type,
                          Parent.currentUser.FULLNAME,
                          Parent.guid);
          Context.SPC_SENDING_TRACE.AddObject(trace);
          if (Context.SaveChanges(result) == false)
              return false;
          return true;
  
      }
  </code></pre>
  
  <p>the Context is different for each thread, but the connection with the DB is always the same.</p>
  
  <p>is there a way to solve this problem?</p>
  
  <p>thank you
  Andrea</p>