Answer the question
In order to leave comments, you need to log in
Entity Framework and contexts?
If I received an object from one context, then I pass it to the method, where I open the same context.
I make changes to the object and do SaveChanges, will the data be saved in the database or should I do SaveChanges in the context where I selected the object from?
Answer the question
In order to leave comments, you need to log in
Example:
var context1=new MyContext();
var context2=new MyContext();
var entity1=context1.Entities1.First();
entity1.Field1=5;
context2.SaveChanges();
context2.Entry(entity1).State = EntityState.Modified;
context2.SaveChanges();
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question