使用分析器之后,我们注意到由于实体框架执行的查询,我们的应用程序加载速度较慢。
SELECT
[Extent1].[TABLE_NAME] AS [TABLE_NAME],
[Extent1].[COLUMN_NAME] AS [COLUMN_NAME],
[Extent1].[TABLE_CATALOG] AS [TABLE_CATALOG],
[Extent1].[TABLE_SCHEMA] AS [TABLE_SCHEMA],
[Extent1].[ORDINAL_POSITION] AS [ORDINAL_POSITION],
[Extent1].[COLUMN_DEFAULT] AS [COLUMN_DEFAULT],
[Extent1].[IS_NULLABLE] AS [IS_NULLABLE],
[Extent1].[DATA_TYPE] AS [DATA_TYPE],
[Extent1].[CHARACTER_MAXIMUM_LENGTH] AS [CHARACTER_MAXIMUM_LENGTH],
[Extent1].[CHARACTER_OCTET_LENGTH] AS [CHARACTER_OCTET_LENGTH],
[Extent1].[NUMERIC_PRECISION] AS [NUMERIC_PRECISION],
[Extent1].[NUMERIC_PRECISION_RADIX] AS [NUMERIC_PRECISION_RADIX],
[Extent1].[NUMERIC_SCALE] AS [NUMERIC_SCALE],
[Extent1].[DATETIME_PRECISION] AS [DATETIME_PRECISION],
[Extent1].[CHARACTER_SET_CATALOG] AS [CHARACTER_SET_CATALOG],
[Extent1].[CHARACTER_SET_SCHEMA] AS [CHARACTER_SET_SCHEMA],
[Extent1].[CHARACTER_SET_NAME] AS [CHARACTER_SET_NAME],
[Extent1].[COLLATION_CATALOG] AS [COLLATION_CATALOG],
[Extent1].[COLLATION_SCHEMA] AS [COLLATION_SCHEMA],
[Extent1].[COLLATION_NAME] AS [COLLATION_NAME],
[Extent1].[DOMAIN_CATALOG] AS [DOMAIN_CATALOG],
[Extent1].[DOMAIN_SCHEMA] AS [DOMAIN_SCHEMA],
[Extent1].[DOMAIN_NAME] AS [DOMAIN_NAME]
FROM [information_schema].[columns] AS [Extent1]
因此,此查询获取有关数据库的所有信息。但我们想知道为什么以及是否有可能阻止它或使其更快。
答案 0 :(得分:1)
这样,EF确保应用中的模型有效,并且模型架构与数据库架构同步。 EF只是这样工作