EF6 don't use pre-generated views

被刻印的时光 ゝ 提交于 2019-12-11 14:48:25

问题


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.

The problem is that these views are not used at run-time. ViewsForBaseEntitySets2F2... class never gets initialized and performance is still poor.

How to force EF to use pre-generated views?

If it must use it by default (looking for EntityViewGenerationAttribute on assembly) then what I have done wrong and how to diagnose that?

UPD I've just found System.Data.Entity.Infrastructure.MappingViews namespace which is confusing.

Also, there are several unanswered questions:

Entity Framework Pre-Generated View on Assembly

ADO.NET Entity Framework - Pre-Generate Views -

How do Entity Framework pre-compiled views get loaded


回答1:


Here is an article which is not outdated: http://msdn.microsoft.com/en-us/data/dn469601.aspx

It answers all questions.



来源:https://stackoverflow.com/questions/27529039/ef6-dont-use-pre-generated-views

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!