Lets say that i have 2 instances of the same entity, a and b
a.SomeProp = 2;
b.SomeProp = 1;
I would like to update a with b:s properties:
a = b;
context.SaveChanges();
(a is attached to the context, b is not)
However, the values are not updated. I suppose im doing it the wrong way. Any help is much appreciated.
If you do
then you set
apointing to the same object asb(and the original object pointed to is discarded).You need to assign the properties you want to update, like: