EF6 and predefined views

I am using the first EF code method in my project. I recently upgraded the EF version of my project to EF 6 using the package manager console.

All my objects inherit from the BaseEntity class as a superclass:

 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 } .... } 

Nor do I add BaseEntity to my DbContext , the program runs without any problems, but since I added the pre-generated views to my project using the EF6 CodeFirst View Generation T4 Template for C # , when I create the views, there are no problems, but when I run my project, I got the following error:

The current model no longer matches the model used to pre-generate the mapping views, as indicated by the ViewsForBaseEntitySets786b989cf4a349108a38357765a23070.MappingHashValue property. Pre-created display views must be either regenerated using the current model, or deleted if display views generated at run time should be used instead. See http://go.microsoft.com/fwlink/?LinkId=318050 for more information on Entity Framework object representation views.

Does anyone know where the problem is? Or at least what way to find a problem?

+2
c # entity-framework ef-code-first t4
source share
1 answer

Most likely you will click this error . The name suggests that it has been fixed in EF 6.1.0 alpha - can you try this release and confirm? If you still see the error, can you create an error at https://entityframework.codeplex.com/WorkItem/Create ? Be sure to attach your model - without a model it will be very difficult to fix this error. Another approach is to use another project to create an interactive presentation of EF. Here you can find more information here and here . The project is available on NuGet . Finally, is your model really so large that you need to use pre-created views? Generational performance has improved significantly in EF6 (and more improvements in 6.1), so I wonder if you really see a significant improvement in application startup time when using pre-generated views.

+3
source share

All Articles