Click here to Skip to main content
15,887,485 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
I'm Trying to update entry using EF 6.0, and generic repository. here is my base class code:
C#
<pre>public virtual void Edit(T entity)
    {
         _entities.Entry(entity).State = EntityState.Modified;
        _entities.SaveChanges();

    }
public virtual  T GetById(int id)
    {

        return _entities.Set<T>().Find(id);
    }


Here is code for updating data
C#
int id = Convert.ToInt32(HiddenField1.Value);

            tblamt = amtdll.GetById(id);
            tblamt.Amt_Type = txt_amt_type.Text;
            tblamt.UserId = User.Identity.GetUserId();
                if (CheckBox1.Checked == true)
                {
                    tblamt.IsActive = true;
                }
                else
                {
                    tblamt.IsActive = false;
                }
                amtdll.Edit(tblamt);


But when i hit the update button it shows the following error. Method not found: 'Void System.Data.Entity.Infrastructure.DbEntityEntry`1.set_State(System.Data.EntityState)'.

please help me thanks

What I have tried:

i have updated EF in my current project to 6.0.2
Posted
Comments
Richard Deeming 20-Mar-18 9:20am    
Sounds like you haven't deployed the correct version of the EntityFramework assembly with your application.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900