Exemple #1
0
        private static RecordInfo TryGetLatestRecord(string tableName, Operation operation)
        {
            //grab the latest LSN
            LogSequenceNumber latestLsn = TestUtil.GetLastTransactionBeginLsn();

            if (latestLsn == null)
            {
                return(null);
            }
            //start log reader
            LogReader         reader  = new LogReader(TestUtil.Connection);
            List <RecordInfo> records = new List <RecordInfo>();

            reader.RecordReceived += delegate(RecordInfo record)
            {
                if (record.Operation == operation && record.Table != null &&
                    tableName.Equals(record.Table.Name))
                {
                    records.Add(record);
                }
            };
            reader.Poll(latestLsn);
            return(records.Count == 0 ? null : records[0]);
        }