title: Method not found DbEntityEntry.get_State()
body: <ul>
  <li>VS2012</li>
  <li>EF 6.0.2</li>
  </ul>
  
  <p>I have a method call as follows which generates the exception <strong>Method not found: 'System.Data.EntityState System.Data.Entity.Infrastructure.DbEntityEntry.get_State()</strong> when I make the call <strong>dataRepository.Update(platformUser);</strong>:</p>
  
  <pre><code> public void LoginDelete(string aUserName)
          {
              MembershipUser loginToDelete = Membership.GetUser(aUserName);
  
              if (loginToDelete != null)
              {
                  using (DataRepository dataRepository = DataRepository.Instance())
                  {
                      using (TransactionScope transaction = dataRepository.Transaction())
                      {
                          string userMembershipId = loginToDelete.ProviderUserKey.ToString();
                          PlatformUser platformUser = dataRepository.SingleOrDefault&lt;PlatformUser&gt;(r =&gt; r.MembershipUserId == userMembershipId);
  
                          if (platformUser != null)
                          {
                              platformUser.MembershipUserId = "";
                              dataRepository.Update&lt;PlatformUser&gt;(platformUser);
                              dataRepository.Save();
                          }
  
                          Membership.DeleteUser(aUserName);
  
                          transaction.Complete();
                      }
                  }
  </code></pre>
  
  <p>and my data repository is defined as follows:</p>
  
  <pre><code>public class EntityFrameworkRepository : IRepository
  {
      private readonly DbContext _DataContext;
  
      public EntityFrameworkRepository(DbContext aDataContext)
      {
          _DataContext = aDataContext;
      }
  
      public int Save()
      {
          return _DataContext.SaveChanges();
      }
  
      public T SingleOrDefault&lt;T&gt;(Expression&lt;Func&lt;T, bool&gt;&gt; aPredicate) where T : class
      {
          return _DataContext.Set&lt;T&gt;()
                             .SingleOrDefault(aPredicate);
      }
  
  
      public TransactionScope Transaction(TransactionScopeOption aTransactionScopeOption = TransactionScopeOption.RequiresNew,
          IsolationLevel aIsolationLevel = IsolationLevel.ReadUncommitted)
      {
          return new TransactionScope(aTransactionScopeOption,
              new TransactionOptions
              {
                  IsolationLevel = aIsolationLevel
              }
              );
      }
  
      public void Update&lt;T&gt;(T aEntity) where T : class
      {
          DbEntityEntry entityEntry = _DataContext.Entry(aEntity);
          if (entityEntry.State == EntityState.Detached)
          {
              _DataContext.Set&lt;T&gt;()
                          .Attach(aEntity);
              entityEntry.State = EntityState.Modified;
          }
      }
  
      public DbContext DataContext
      {
          get { return _DataContext; }
      }
  
  }
  
  public class DataRepository : EntityFrameworkRepository, IDisposable, IDataRepository
  {
      public DataRepository()  : base(new DataContext())
      {
      }
  
      public static DataRepository Instance()
      {
          return new DataRepository();
      }
  
  } 
  </code></pre>
  
  <p>Can someone explain to me why I am getting the exception and how I fix it?</p>