同じデータで 2 回更新しようとしましたが、例外がスローされました
public void UpdateOnSubmit<T>(T data) where T : class
{
lock (_lockObj)
{
using (DataModel dx = new DataModel(this._adapter.ConnectionString))
{
dx.GetTable<T>().Attach(data);
dx.Refresh(RefreshMode.KeepCurrentValues, data);
dx.SubmitChanges();
}
}
}
例外は
An attempt has been made to Attach or Add an entity that is not new, perhaps having been loaded from another DataContext. This is not supported.
最初の更新は成功しますが、2 回目は成功しません。前もって感謝します
よろしく、
ブライアン