我不是超級熟悉的LINQ to SQL還,但東西給我的印象是這樣的:linq to sql將這個查詢翻譯成如下格式效率不高:「select *」?
var articles =
(from a in DB.Articles
where
a.ArticleId == ArticleId.Question &&
a.DeletedAt == null &&
a.Votes >= minVotes
orderby a.UpdatedAt descending
select a).
Take(maxarticles);
被轉換到這一點:
string query =
"select top 10 * from articles
where
ArticleId = 1 and
DeletedAt is null and
Votes >= -5
order by UpdatedAt desc";
這令我出效率低下,LINQ to SQL的願意使用「select *」類型的查詢抽空所有內容。 這不是沒有效率嗎?
爲什麼linq to sql這樣做?