示例#1
0
 public void PushError(EntityException ex)
 {
     lock (queueException)
     {
         queueException.Enqueue(ex);
     }
 }
示例#2
0
        /// <summary>
        /// Вставка ошибок
        /// </summary>
        /// <param name="exception"></param>
        public async void InsertException(EntityException exception)
        {
            var query = $@"INSERT INTO ExceptionTable
                        VALUES ('{exception.Class}', '{exception.Method}', '{Normalize(exception.ExceptionMessage)}', '{exception.Date}' )";

            await InsertCommand(query);
        }
示例#3
0
        protected override void Work()
        {
            while (true)
            {
                EntityMessage   message   = null;
                EntityException exception = null;
                lock (queueMessage)
                {
                    if (queueMessage.Count > 0)
                    {
                        message = queueMessage.Dequeue();
                    }
                }

                if (message != null)
                {
                    SendMessageToDb(message);
                }

                lock (queueException)
                {
                    if (queueException.Count > 0)
                    {
                        exception = queueException.Dequeue();
                    }
                }
                if (exception != null)
                {
                    SendExceptionToDb(exception);
                }
                if (_state.IsDoneReading && _state.IsDoneWorkers && queueMessage.Count == 0 && queueException.Count == 0)
                {
                    _state.IsDoneWriting = true;
                    break;
                }
            }
        }
示例#4
0
        private void SendExceptionToDb(EntityException ex)
        {
            ISqlInsert sqlInsert = new SqlInsert(_connectionString);

            sqlInsert.InsertException(ex);
        }