Ejemplo n.º 1
0
        private object Execute(DbConnection connection, DbTransaction transaction, TCOMMAND commandObject, ExecType execType)
        {
            Init();

            object _result = null;

            using (DbCommand command = connection.CreateCommand())
            {
                command.CommandText    = _Helper.CommandAttribute.CommandText;
                command.CommandType    = _Helper.CommandAttribute.CommandType;
                command.CommandTimeout = _Helper.CommandAttribute.CommandTimeout;
                command.Transaction    = transaction;

                _Helper.SetParameters(command, commandObject);

                RaisePreExecute(connection, command);

                if (execType == ExecType.Scalar)
                {
                    _result = command.ExecuteScalar();
                }
                else
                {
                    command.ExecuteNonQuery();
                }

                _Helper.GetParameters(command, commandObject);
            }
            return(_result);
        }