title: transaction is not getting commit in entity framework
body: <p>Trying to execute complex procedure and saving a data in table in transaction using entity framework. When my code commits the transaction then it is throwing exception</p>
  
  <p><strong>The transaction operation cannot be performed because there are pending requests working on this transaction.</strong></p>
  
  <p>Below is the code.</p>
  
  <pre><code>using (abcEntities dbContext = new abcEntities())
          {
              using (var transaction = dbContext.Database.BeginTransaction())
              {
                  dbContext.USP_ResellerCustomerFile_DeleteFiles(customerId, fileId, 1);
                  ResellerAndCustomerActivityDAL objCustomerActivityDAL = new ResellerAndCustomerActivityDAL();
  
                  ResellerAndCustomerActivity objActivity = new ResellerAndCustomerActivity()
                  {
                      Activity = objfile.FileName + " is temporairly permanently deleted.",//message.ReplacingSpecialCharacterswithEntities(),
                      ActivityDate = DateTime.UtcNow,
                      ResellerAndCustomerId = customerId,
                      UserTypeId = 2
  
                  };
  
                  dbContext.ResellerAndCustomerActivities.Add(objActivity);
  
                  //objCustomerActivityDAL.Create(objfile.FileName + " is permanently deleted.", objUnit, out returnMessage, customerId);
  
                  dbContext.SaveChanges();
                  transaction.Commit();
              }
          }
  </code></pre>
  
  <p>Don't know why it is throwing pending request exception because I am executing it in same transaction.</p>
  
  <p><strong>Below is complete stack trace</strong></p>
  
  <pre><code>   at System.Data.Entity.Infrastructure.Interception.InternalDispatcher`1.Dispatch[TTarget,TInterceptionContext](TTarget target, Action`2 operation, TInterceptionContext interceptionContext, Action`3 executing, Action`3 executed)
     at System.Data.Entity.Infrastructure.Interception.DbTransactionDispatcher.Commit(DbTransaction transaction, DbInterceptionContext interceptionContext)
     at System.Data.Entity.Core.EntityClient.EntityTransaction.Commit()
     at System.Data.Entity.DbContextTransaction.Commit()
     at BoomerangResellerAPI.DAL.ResellerCustomerFileDAL.DeleteFile(Int32 customerId, Int32 fileId, String&amp; returnMessage) in D:\Varinder\Working Folder\Boomerang Backup\API\BoomerangResellerAPI\BoomerangResellerAPI\BoomerangResellerAPI.DAL\ResellerCustomerFileDAL.cs:line 325
     at BoomerangResellerAPI.BLL.ResellerCustomerFileBLL.DeleteFile(Guid uniqueCustomerId, Int32 fileId, String&amp; returnMessage) in D:\Varinder\Working Folder\Boomerang Backup\API\BoomerangResellerAPI\BoomerangResellerAPI\BoomerangResellerAPI.BLL\ResellerCustomerFileBLL.cs:line 100
     at BoomerangResellerAPI.Controllers.FilesController.TemporaryDelete(Nullable`1 customerUniqueId, Nullable`1 fileId) in D:\Varinder\Working Folder\Boomerang Backup\API\BoomerangResellerAPI\BoomerangResellerAPI\BoomerangResellerAPI\Controllers\FilesController.cs:line 195
  </code></pre>