1. Compiled Query
Func<OfflineDataContext, int> getNewsCount =
CompiledQuery.Compile((OfflineDataContext newsDB1) =>
(from News p in newsDB1.StoredNewsList
where p.CId == cid
select p).Count());
int storedCurCount = getNewsCount(newsDB);