public void ProcessEachRow(OracleCommand command, out string errorMessage, DbRowProcessor readerData, List <Thread> threads = null)
        {
            string _errorMessage = string.Empty;

            if (threads != null)
            {
                var thread = new Thread(() =>
                {
                    using (var conn = new OracleConnection())
                    {
                        ProcessEachRow(conn, command, out _errorMessage, readerData);
                    }
                });

                thread.CurrentCulture   = Thread.CurrentThread.CurrentCulture;
                thread.CurrentUICulture = Thread.CurrentThread.CurrentUICulture;
                threads.Add(thread);
                thread.Start();
            }
            else
            {
                using (var conn = new OracleConnection())
                {
                    ProcessEachRow(conn, command, out _errorMessage, readerData);
                }
            }

            errorMessage = _errorMessage;
        }
        public void SequentialAccess(OracleCommand command, bool connOpen, out string errorMessage, DbRowProcessor readerData = null)
        {
            errorMessage = String.Empty;
            try
            {
                if (command.Connection == null)
                {
                    var conn = new OracleConnection {
                        ConnectionString = _connStr
                    };
                    command.Connection = conn;

                    try
                    {
                        conn.Open();
                        command.Transaction = conn.BeginTransaction();
                    }
                    catch (Exception ex)
                    {
                        command.Transaction.Rollback();
                        command.Dispose();
                        command.Connection.Dispose();
                        errorMessage = ex.Message;
                    }
                }

                if (connOpen)
                {
                    try
                    {
                        OracleDataReader reader = command.ExecuteReader(CommandBehavior.SequentialAccess);

                        if (readerData != null)
                        {
                            while (reader.Read())
                            {
                                try
                                { readerData.Invoke(reader); }
                                catch (Exception ex)
                                {
                                    errorMessage = ex.Message;
                                    break;
                                }
                            }
                        }

                        reader.Dispose();
                    }
                    catch (Exception ex)
                    {
                        command.Transaction.Rollback();
                        command.Dispose();
                        command.Connection.Dispose();
                        errorMessage = ex.Message;
                    }
                }
                else
                {
                    try
                    {
                        command.Dispose();
                        command.Connection.Dispose();
                    }
                    catch (Exception ex)
                    {
                        command.Transaction.Rollback();
                        errorMessage = ex.Message;
                    }
                    finally
                    {
                        command.Connection.Dispose();
                    }
                }
            }
            catch (Exception ex)
            {
                if (command.Connection != null)
                {
                    command.Connection.Dispose();
                }
                errorMessage = ex.Message;
            }
        }
        protected void ProcessEachRow(OracleConnection conn, OracleCommand command, out string errorMessage, DbRowProcessor readerData)
        {
            errorMessage = String.Empty;

            conn.ConnectionString = _connStr;
            command.Connection    = conn;

            try
            { conn.Open(); }
            catch (Exception ex)
            {
                errorMessage = ex.Message;
                return;
            }

            OracleDataReader reader;

            try
            {
                reader = command.ExecuteReader();
            }
            catch (Exception ex)
            {
                errorMessage = ex.Message;
                command.Dispose();
                conn.Dispose();
                return;
            }

            while (reader.Read())
            {
                try
                { readerData.Invoke(reader); }
                catch (Exception ex)
                {
                    errorMessage = ex.Message;
                    break;
                }
            }

            try
            {
                reader.Dispose();
                //Command.Dispose();
                conn.Dispose();
            }
            catch (Exception ex)
            {
                errorMessage = ex.Message;
            }
        }