int totalCount = 0;
int amountToSkip = 0;
int processAmount = 0;
Boolean finished = false;
using(var context = new {{DataContext}}())
{
totalCount = context.{{테이블}}.Where({{조건절}}).Count();
while (!finished)
{
resultList = context.{{테이블}}
.Where({{조건절}})
.OrderBy({{정렬조건}}) //Skip, Take 사용을 위해 정렬 필수
.Skip(amountToSkip)
.Take(1000).ToList(); //Take 수는 적절히 조정
processAmount = resultList.Count;
if (resultList.Count.Equals(0))
finished = true;
else
{
foreach (var item in resultList)
{
//처리 로직
}
}
resultList = null;
amountToSkip += processAmount;
Console.WriteLine("current/total : " + amountToSkip + "/" + totalCount); //현재 진행률
}
}