Updates to Entity Framework are not functioning.

entity-framework poco

Question

Using entity framework, I'm attempting to change a POCO object in the following manner:

 context.Jobs.Attach(job);
 context.SaveChanges();

That is ineffective. The values in the database aren't being updated, but no errors are being thrown.

I attempted to

context.Jobs.AttachTo("Jobs", job);
context.SaveChanges();

Nothing is incorrect; there are no errors or changes.

1
14
1/18/2011 7:35:06 PM

Accepted Answer

What if you altered theObjectState ?

context.ObjectStateManager.ChangeObjectState(job, System.Data.EntityState.Modified);

Zzz-14-Zzz from MSDN.

20
1/18/2011 8:23:11 PM

Popular Answer

Check the second portion of this response to confirm that you are dealing with a disconnected item.



Related Questions





Related

Licensed under: CC-BY-SA with attribution
Not affiliated with Stack Overflow
Licensed under: CC-BY-SA with attribution
Not affiliated with Stack Overflow