private bool BeginEditInternal()
{
if (_inChangingEvent)
{
throw ExceptionBuilder.BeginEditInRowChanging();
}
if (_tempRecord != -1)
{
if (_tempRecord < _table._recordManager.LastFreeRecord)
{
return false; // we will not call EndEdit
}
else
{
// partial fix for detached row after Table.Clear scenario
// in debug, it will have asserted earlier, but with this
// it will go get a new record for editing
_tempRecord = -1;
}
// shifted VerifyRecord to first make the correction, then verify
_table._recordManager.VerifyRecord(_tempRecord, this);
}
if (_oldRecord != -1 && _newRecord == -1)
{
throw ExceptionBuilder.DeletedRowInaccessible();
}
ResetLastChangedColumn(); // shouldn't have to do this
_tempRecord = _table.NewRecord(_newRecord);
Debug.Assert(-1 != _tempRecord, "missing temp record");
Debug.Assert(0 == _countColumnChange, "unexpected column change count");
Debug.Assert(null == _lastChangedColumn, "unexpected last column change");
return true;
}