System.Data.Common.DbCommandBuilder.InitializeCommand C# (CSharp) Method

InitializeCommand() protected method

protected InitializeCommand ( DbCommand command ) : DbCommand
command DbCommand
return DbCommand
        protected virtual DbCommand InitializeCommand(DbCommand command)
        {
            if (null == command)
            {
                DbCommand select = GetSelectCommand();
                command = select.Connection.CreateCommand();
                /*if (null == command) {
                    // CONSIDER: throw exception
                }*/

                // the following properties are only initialized when the object is created
                // all other properites are reinitialized on every row
                /*command.Connection = select.Connection;*/ // initialized by CreateCommand
                command.CommandTimeout = select.CommandTimeout;
                command.Transaction = select.Transaction;
            }
            command.CommandType = CommandType.Text;
            command.UpdatedRowSource = UpdateRowSource.None; // no select or output parameters expected
            return command;
        }