简体   繁体   English

EF6不使用预先生成的视图

[英]EF6 don't use pre-generated views

I've pregenerated views using this instruction: http://msdn.microsoft.com/en-us/library/vstudio/bb896240(v=vs.100).aspx and already have Model.Views.cs file in my project with my context and all entities. 我已经使用以下指令Model.Views.cs生成了视图: http : //msdn.microsoft.com/zh-cn/library/vstudio/bb896240 ( Model.Views.cs ,并且我的项目中已经包含Model.Views.cs文件,我的背景和所有实体。

The problem is that these views are not used at run-time. 问题在于这些视图在运行时未使用。 ViewsForBaseEntitySets2F2... class never gets initialized and performance is still poor. ViewsForBaseEntitySets2F2...类永远不会初始化,并且性能仍然很差。

How to force EF to use pre-generated views? 如何强制EF使用预先生成的视图?

If it must use it by default (looking for EntityViewGenerationAttribute on assembly) then what I have done wrong and how to diagnose that? 如果默认情况下必须使用它(在程序集上查找EntityViewGenerationAttribute ),那么我做错了什么以及如何诊断呢?

UPD I've just found System.Data.Entity.Infrastructure.MappingViews namespace which is confusing. UPD我刚刚发现System.Data.Entity.Infrastructure.MappingViews命名空间令人困惑。

Also, there are several unanswered questions: 此外,还有几个未解决的问题:

Entity Framework Pre-Generated View on Assembly 实体框架关于装配的预生成视图

ADO.NET Entity Framework - Pre-Generate Views - ADO.NET实体框架-预先生成的视图-

How do Entity Framework pre-compiled views get loaded 如何加载Entity Framework预编译的视图

Here is an article which is not outdated: http://msdn.microsoft.com/en-us/data/dn469601.aspx 这是一篇不落伍的文章: http : //msdn.microsoft.com/zh-cn/data/dn469601.aspx

It answers all questions. 它回答了所有问题。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM