Code: Select all
var newRecord = new TEST();
newRecord.ID = 1;
newRecord.FIRSTNAME = "Some";
newRecord.LASTNAME = "Two";
using (var context = GetDataContext())
{
context.TESTs.Attach(newRecord, true);
//ChangeSet changeSet = context.GetChangeSet();
context.SubmitChanges();
}
That said, if I look up the entity I want to change in the context scope first and call Attach(entity, original) then it does work.
Code: Select all
var newRecord = new TEST();
newRecord.ID = 1;
newRecord.FIRSTNAME = "Some";
newRecord.LASTNAME = "Two";
using (var context = GetDataContext())
{
var record = context.TESTs.FirstOrDefault(o => o.ID == 1);
context.TESTs.Attach(newRecord, record);
//ChangeSet changeSet = context.GetChangeSet();
context.SubmitChanges();
}
A call to Attach(entity, bool) did work for previous versions of dotConnect that we have used (i.e. 6.80). We are now using 7.2.77. Has anything changed in the latest version regarding Attach(entity, bool)..are there any other settings required for this to work?
Note 1: All properties in the model/lqml are set to Update Check = Never.
Note 2: No exception is thrown. There simply isn't any UPDATE SQL generated and thus no change in the database (obviously).