【发布时间】:2023-03-21 22:05:02
【问题描述】:
我对 Linq to SQL 还不是很熟悉,但让我印象深刻的是:
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 会这样呢?
【问题讨论】:
标签: .net sql database performance linq-to-sql