title: Why I am not able to get recently added objects (yet to be saved in database) from repository
body: <p>I am developing an asp.net mvc4 application in which repository and unit of work pattern was implemented. I want some solution to get the newly added data from repository means i want to able to manipulate the data's before it saving into database.</p>
  
  <p>I learned like the objects are available in the EF Change Tracking mechanism, so they should be available , even though it has not yet been saved to the database. By keeping this in mind only am doing the below stuffs</p>
  
  <p>Below is my controller...</p>
  
  <pre><code>   Public void save(Order orderdata)
     {
        if(orderdata.Id &gt; 0)
        {
              ....
              ....
              ....        // after validating the data's I will be calling the Save() service method which i mentioned below.
              save(orderdata,false);   //Calling service method to attach data to repository
        }
        //after attaching the orderdata to reposistory i am calling a private method to modify above freshly added orderdata(i.e., orderdata which is recently added into repository but not saved into database)
        UpdateOrder(order)
     }
  </code></pre>
  
  <p>Below is my private method...</p>
  
  <pre><code>    private void UpdateOrder(Order order)
      {
  
          if (order != null)
          {
                  var orderRequest = GetOrderRequest&lt;Order&gt;(x =&gt; x.TrackingNumber == order.TrackingNumber); //calling GetOrderRequest() service method which i mentioned below
  
                  if (orderRequest != null)
                  {
                      ...
                      ...// after some validations only i need to assign a status to newly added order.
                      orderRequest.Status = "assigned";
                  }
              }
          }
      }
  </code></pre>
  
  <p>Below is my service methods implementation...</p>
  
  <pre><code>  public void Save(Order obj, bool Commit = true)
      {
          if (obj.Id &gt; 0)
          {
              // Adding Order obj to repository.
              OrderRepository.Attach(obj);
          }
          else
              OrderRepository.Add(obj);
  
          // Note: While I am calling my save() service method am passing commit as 'False' in order to prevent it from saving into database so that after some transaction i will finally save all the data into database.           
          if (Commit)
              Commit();
      }
  
      public IQueryable&lt;T&gt; GetOrderRequest&lt;T&gt;(Expression&lt;Func&lt;T, bool&gt;&gt; predicate = null) where T : WorkRequest
      {
          var query = OrderRepository.FindAll().OfType&lt;T&gt;(); 
  
          if (predicate != null)
              query = query.Where(predicate);
  
          return query; //Here I am expecting the newly added data
      }
  </code></pre>
  
  <p>Now my issue is i want to access the freshly added data in the repository to update my order status. But i am not able to do so because GetOrderRequest return always null. Is am doing anything wrong or is there any other way to get freshly added entities from repository. Please give me some suggestions on this...</p>