public void CopyAll() { using (var baseUOW = dBProvider.GetRaspperyUnitOwWork()) { var idList = new XPQuery <TemperatureValue>(baseUOW) .Select(item => item.Id) .ToList(); for (int batchNum = 0; batchNum <= idList.Count / 2000; batchNum++) { CopyBatch(idList.Skip(batchNum * 2000).Take(2000).ToList()); } } }