-2

我有一个 Lambda 表达式,它导致“序列中的多个值”,即数据重复。这是 lambda 表达式:

var destinations = this.contentBusiness.GetAllDisplayVersions()
.Where(x => airportDestinations.Any(y => y.DestinationAirport.DestinationGuideId == x.ParentId))
.Select(x => new DestinationViewModel(airportDestinations.Single(y => y.DestinationAirport.DestinationGuideId == x.ParentId), x));

现在我需要相应的 SQL 语句

4

1 回答 1

0

为什么不运行 SQL Profiler?

  • 在这条线上设置一个断点。
  • 在下一行放置 destinations.AsEnumerable() 以强制运行 SQL。
  • 运行应用程序。
  • 当断点命中运行时启动分析器跟踪
  • 运行到 AsEnumerable() 或等效行(即强制生成 SQL 并针对 SQL Server 运行的行)
  • 看看 SQL Profiler 发现了什么。
于 2013-10-01T13:06:07.257 回答