v9.8.2018.0605   由DataReader直接映射实体列表,以支持netstandard的MySql和SQLite,且提升性能
大石头 authored at 2018-06-05 00:45:23
980.00 B
X
using System;
using System.Collections.Generic;

namespace NewLife.Queue.Broker
{
    public class BatchMessageLogRecord
    {
        private readonly IEnumerable<MessageLogRecord> _records;
        private readonly Action<BatchMessageLogRecord, object> _callback;
        private readonly object _parameter;

        public IEnumerable<MessageLogRecord> Records
        {
            get { return _records; }
        }
        public Action<BatchMessageLogRecord, object> Callback
        {
            get { return _callback; }
        }

        public BatchMessageLogRecord(IEnumerable<MessageLogRecord> records, Action<BatchMessageLogRecord, object> callback, object parameter)
        {
            _records = records;
            _callback = callback;
            _parameter = parameter;
        }

        public void OnPersisted()
        {
            if (_callback != null)
            {
                _callback(this, _parameter);
            }
        }
    }
}