Page 1 of 1

Changing Entity State

Posted: Mon 17 Aug 2015 19:03
by cvboucher
I'm working on some .Net Web Api web services with an Entity Developer generated DataContext (PostgreSQL). The standard practice on a Put seems to be to change the EntityState of the incoming object and SaveChanges.

https://msdn.microsoft.com/en-us/data/j ... 2147217396

I'm getting an error with the following line of code that there is no definition for Entry.

Code: Select all

db.Entry(job).State = EntityState.Modified;
Here is the complete error message:

Error 1 'PieceCounter.Data.PieceCounterDataContext' does not contain a definition for 'Entry' and no extension method 'Entry' accepting a first argument of type 'PieceCounter.Data.PieceCounterDataContext' could be found (are you missing a using directive or an assembly reference?)

Thanks,
Craig

Re: Changing Entity State

Posted: Tue 18 Aug 2015 10:15
by Shalex
Please refer to http://stackoverflow.com/questions/1103 ... sion-metho. You can check your current active template via Tools > Entity Developer > Model Explorer.