我的项目是EF 5,使用DbContext。
我刚刚注意到我第一次在LinqPad中运行任何Linq查询时,有一点延迟,生成的SQL从以下开始。随后的运行,没有延迟,没有额外的SQL。
任何人都可以向我解释这个SQL是什么,以及我是否应该担心它?
SELECT TABLE_SCHEMA SchemaName, TABLE_NAME Name FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_TYPE = 'BASE TABLE'
GO
SELECT
[GroupBy1].[A1] AS [C1]
FROM ( SELECT
COUNT(1) AS [A1]
FROM [dbo].[__MigrationHistory] AS [Extent1]
) AS [GroupBy1]
GO
SELECT TOP (1)
[Extent1].[Id] AS [Id],
[Extent1].[ModelHash] AS [ModelHash]
FROM [dbo].[EdmMetadata] AS [Extent1]
ORDER BY [Extent1].[Id] DESC
GO
答案 0 :(得分:3)
首先是EF代码,验证您的数据库是否与模型匹配,以确保一切正常。
别担心!