/// <summary>
        ///     Updates the command text for the command at the given position in the
        ///     <see cref="ModificationCommands" /> list.
        /// </summary>
        /// <param name="commandPosition"> The position of the command to generate command text for. </param>
        protected virtual void UpdateCachedCommandText(int commandPosition)
        {
            var newModificationCommand = ModificationCommands[commandPosition];

            switch (newModificationCommand.EntityState)
            {
            case EntityState.Added:
                CommandResultSet[commandPosition] =
                    UpdateSqlGenerator.AppendInsertOperation(CachedCommandText, newModificationCommand, commandPosition);
                break;

            case EntityState.Modified:
                CommandResultSet[commandPosition] =
                    UpdateSqlGenerator.AppendUpdateOperation(CachedCommandText, newModificationCommand, commandPosition);
                break;

            case EntityState.Deleted:
                CommandResultSet[commandPosition] =
                    UpdateSqlGenerator.AppendDeleteOperation(CachedCommandText, newModificationCommand, commandPosition);
                break;
            }

            LastCachedCommandIndex = commandPosition;
        }
 /// <summary>
 ///     Resets the builder to start building a new batch.
 /// </summary>
 protected virtual void ResetCommandText()
 {
     CachedCommandText = new StringBuilder();
     UpdateSqlGenerator.AppendBatchHeader(CachedCommandText);
     LastCachedCommandIndex = -1;
 }