Before stating my question: I´ll be using only one DataContext througout the entire application.
My question is as follow:
Suppose I called InsertOnSubmit() repeatedly for one or more entities, but before SubmitChanges() call, some external event (user changed her mind, some new data arrived) all the inserts must be discarded. And not to be included in some other SubmitChanges() from another part of the app.
Of course, if I were using one DataContext for this transaction only, it´s not a problem; simply Dispose it.
But because all editions must be done on instances read by the same DataContext (*), it seems to me more convenient to create the context at the app startup and use it for everything.
(*) I tried to Attach() a disconnected instance before call SubmitChanges(), but received an exception.
Any help will be appreciated.
How to "unwind" one or more InsertOnSubmit() calls
Re: How to "unwind" one or more InsertOnSubmit() calls
Please refer to https://www.devart.com/linqconnect/docs ... ities.html.
If this doesn't help, tell us how we should modify this sample to reproduce the issue:
Also specify the exact text of the error and its full stack trace.
If this doesn't help, tell us how we should modify this sample to reproduce the issue:
Code: Select all
// var monitor = new Devart.Data.Linq.Monitoring.LinqMonitor() { IsActive = true };
using (var context = new MyDataContext()) {
var dept = new DEPT() { DEPTNO = 11, DNAME = "test", LOC = "test" };
context.DEPTs.InsertOnSubmit(dept);
dept.DNAME = "newName";
context.DEPTs.DeleteOnSubmit(dept);
context.SubmitChanges();
}