My goal is to copy an existing object, modify it a bit, and paste the modified version.
I tried two different methods that both work:
var thing = context.Things.Where(x => x.SomeID == someid).AsNoTracking().Single(); thing.AnotherID = 1234; context.Things.AddObject(thing); context.SaveChanges(); var thing = context.Things.Where(x => x.SomeID == someid).Single(); context.Detach(thing); thing.AnotherID = 1234; context.Things.AddObject(thing); context.SaveChanges();
From what I can say, they both achieve my goal. Is one of them better than the other, or are they both equally good (or wrong !?)
c # entity-framework
TTT Nov 22 '13 at 20:31 2013-11-22 20:31
source share