private void RowUpdatingHandlerBuilder(RowUpdatingEventArgs rowUpdatingEvent)
{
// the Update method will close the connection if command was null and returned command.Connection is same as SelectCommand.Connection
DataRow datarow = rowUpdatingEvent.Row;
BuildCache(false, datarow, false);
DbCommand command;
switch (rowUpdatingEvent.StatementType)
{
case StatementType.Insert:
command = BuildInsertCommand(rowUpdatingEvent.TableMapping, datarow);
break;
case StatementType.Update:
command = BuildUpdateCommand(rowUpdatingEvent.TableMapping, datarow);
break;
case StatementType.Delete:
command = BuildDeleteCommand(rowUpdatingEvent.TableMapping, datarow);
break;
#if DEBUG
case StatementType.Select:
Debug.Assert(false, "how did we get here?");
goto default;
#endif
default:
throw ADP.InvalidStatementType(rowUpdatingEvent.StatementType);
}
if (null == command)
{
if (null != datarow)
{
datarow.AcceptChanges();
}
rowUpdatingEvent.Status = UpdateStatus.SkipCurrentRow;
}
rowUpdatingEvent.Command = command;
}