Notification from untracked entity received
Posted: Tue 15 Aug 2017 15:48
I´m trying to use a DataContext to read data from the database in a using statement.
Then, when some changes are done to some entity, send the updates using code as follows.
I supposed that the Attach() method was the way to go. But even if I´m updating the (only in this case) property after the Attach(), I´m getting the exception in the subject. The source is Devart.Data.Linq.
What is the correct way? Or must I maintain the DataContext through the entire life of the application?
TIA
Then, when some changes are done to some entity, send the updates using code as follows.
I supposed that the Attach() method was the way to go. But even if I´m updating the (only in this case) property after the Attach(), I´m getting the exception in the subject. The source is Devart.Data.Linq.
What is the correct way? Or must I maintain the DataContext through the entire life of the application?
TIA
Code: Select all
using (FormPrintingDataContext context = FormPrintingDataContext.Get( "nmwiu", "public" )) {
try {
context.FormPrintingStorages.Attach(chgdinstance, readinstance);
chgdinstance.Definition = definition;
}
catch (Exception e) {
MessageBox.Show(String.Format("{0}{1}{2}", e.Message, Environment.NewLine,
e.InnerException != null ? e.InnerException.Message : "No more info"));
}
finally {
context.SubmitChanges();
}
}