我在項目中使用EF代碼第一種方法。最近我使用軟件包管理器控制檯將我的項目的EF版本更新到EF 6
。EF6和預生成視圖
我所有的實體是從BaseEntity
類繼承的超類:
public abstract class BaseEntity
{
public virtual int Id { get; set; }
States _state;
[NotMapped]
public States State { get; set;}
public enum States
{
Unchanged,
Added,
Modified,
Deleted
}
....
}
而且我也不會在我DbContext
添加BaseEntity
,運行的程序沒有任何問題,但自從我加入預先生成的使用EF6 CodeFirst View Generation T4 Template for C#意見,我的項目,我產生是沒有問題的看法,但是當我跑我的項目,我得到了以下錯誤:
The current model no longer matches the model used to pre-generate the mapping views, as indicated by the ViewsForBaseEntitySets786b989cf4a349108a38357765a23070.MappingHashValue property. Pre-generated mapping views must be either regenerated using the current model or removed if mapping views generated at runtime should be used instead. See http://go.microsoft.com/fwlink/?LinkId=318050 for more information on Entity Framework mapping views.
是否知道任何問題出在哪裏?或者至少有什麼方法來找到問題?
謝謝,帕維爾,我試過EF 6.1.0 Alpha,它的工作沒有錯誤。是的,我的應用程序很大(大約500個實體),在升級到EF6之前,我使用了EF4.1,並且通過使用預生成的視圖,我的程序啓動時間大約是不使用它的一半時間,但是當我升級到EF6.1.0 alpha時,我的項目啓動時間沒有任何明顯的改善。 – Masoud
我很高興問題得到解決。請繼續關注EF6.1 RTM。 – Pawel
謝謝帕維爾。我在EF6.1.2中遇到了使用一些繼承的dbcontext的問題。我可以報告這個地方,或者你有這方面的任何知識嗎? – UnreliableWitness