private void EnsurePopulatedMode()
{
// Unbind special listeners, bind permanent ones, setup the mapping, etc
#if DEBUG
bool fDataRowCreatedSpecialOld = _fDataRowCreatedSpecial;
bool fAssociateDataRowOld = _fAssociateDataRow;
#endif
if (_fDataRowCreatedSpecial)
{
UnBindSpecialListeners();
// If a special listener was ON, we should not have had an already set-up mapper or permanent listeners subscribed
Debug.Assert(!_mapper.IsMapped());
Debug.Assert(!_fBoundToDocument);
Debug.Assert(!_fBoundToDataSet);
_mapper.SetupMapping(this, _dataSet);
BindListeners();
// CreateElement should now create associate DataRows w/ new XmlBoundElement nodes
// We should do this ONLY if we switch from special listeners to permanent listeners. The reason is
// that DataDocumentNavigator wants to put XmlDataDocument in a batch mode, where CreateElement will just
// create a XmlBoundElement (see DataDocumentNavigator.CloneTree)
_fAssociateDataRow = true;
}
Debug.Assert(_fDataRowCreatedSpecial == false);
Debug.Assert(_mapper.IsMapped());
Debug.Assert(_fBoundToDataSet && _fBoundToDocument);
#if DEBUG
// In case we EnsurePopulatedMode was called on an already populated mode, we should NOT change fAssociateDataRow
if (fDataRowCreatedSpecialOld == false)
Debug.Assert(fAssociateDataRowOld == _fAssociateDataRow);
#endif
}