LinqPad首次运行EF查询时查询__MigrationHistory [英] LinqPad queries __MigrationHistory on first run of an EF query

查看:98
本文介绍了LinqPad首次运行EF查询时查询__MigrationHistory的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的项目是EF 5,使用DbContext.

My project is EF 5, using DbContext.

我刚刚注意到,我第一次在LinqPad中运行任何Linq查询时,会稍有延迟,并且生成的SQL从以下内容开始.随后的运行,没有延迟,也没有多余的SQL.

I just noticed that the first time I run any Linq query in LinqPad, there is a slight delay, and the generated SQL starts with the following. The subsequent runs, there is no delay and no extra SQL.

任何人都可以向我解释此SQL是什么,如果我应该担心的话?

Can anyone explain to me what this SQL is, and if I should worry about it?

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

推荐答案

首先是EF代码,请验证您的数据库是否与模型匹配,以确保一切正常.

That's EF code first, verifying that your database matches the model to be sure everything will work properly.

不用担心!

这篇关于LinqPad首次运行EF查询时查询__MigrationHistory的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆