Entity Framework Power Tools Beta 3 Eliminates "Sequence Does Not Match Element" When Attempting to Create Views

Struggling against creating the Entity Framework of pre-compiled database views and in need of help.

When using Visual Studio 2010, I was unable to generate precompiled views using the latest beta version of the Power Tools Entity Framework. When I right-click on a file based on dbContext and select the option "Create views", the "Sequence does not contain inappropriate elements" field appears.

Removing the extension of the power tool, restarting Visual Studio and the computer did not help.

Question 1: What could be causing this error. Entity Framework Power Tools is useless until I can get it to work?

Thus, so far the only way I can generate views for this sequence is to use the T4 template (from the Internet), but it is often disabled and not executed. The database has about 350 tables, and the number of views it creates is about 670 views. However, it cannot create representations most of the time, and I have to try many times, and sometimes turn it off and restart to make it work. The processor load during this time is about 12% on the i7 Quad core with SSD and 8 GB of memory, so this is strange. However, when views are generated (without a timeout), they work fine.

Question 2: Is there anything that can be done to save this template in timeout and failure?

Now I can’t just give up. I was looking for other ways, I was able to generate views by creating the first database project and adding the Entity Framework data model created from an existing database. The model was created perfectly, and I can create the views as expected, but they are not recognized when placed in the final assembly, and the entity is trying to query the database. When placed in the assembly, I replaced the view file, which works when creating using the T4 template file created in the Power Tools context menu.

Is the namespace causing this problem?

I think this has something to do with the namespace, but I don't know the rules about how it detects compiled representations, and why you need to call the namespace and representations so that they can be found and used. Views created from the DbContext file are in a different project than views created using the Edmx model of the same database. I have a DbContext Project Project Project Project and a Domain Mapping class project. I put the views file in the same assembly (project) as the domain classes.

The following is an example of a generated view. One of them was created using the T4 template and the “Run Custom Tool”, and the one on the right was created using the Entity Framework Power Tools Beta 3 and selected “Create Views” from the context menu while the cursor is in the EDMX file.

Working:

SELECT VALUE [xxx.yyy.Provider.DataContext.RouteStop](T1.RouteStop_RouteStopId, ... FROM ( SELECT T1.RouteStopId as RouteStop_RouteStopId, ..... FROM CodeFirstDatabase.RouteStop AS T ) AS T1 

Does not work:

 SELECT Value [xxx.yyy.Provider.DataModel.Store.RouteStop](T1.RouteStop_RouteStopId, ... FROM ( SELECT T1.RouteStopId as RouteStop_RouteStopId, ..... FROM ZeeZorProviderEdmx.RouteStops AS T ) AS T1 

The namespace for the project, which contains the domain classes and also contains a copy of the generated views, is "xxx.yyy.Provider.DomainClasses" if that helps.

Question 3: How to get generated Power Tools views from EDMX, working like other view files, create from T4 template.

I lose hearing about it, and I have little left, so I really could use some useful tips. I need a solution, and I see one of three ways:

  • Use the Entity Framework Power Tools Beta 3 and Create Views, a context menu, when an object file based on DbContext is selected.

  • Use the T4 template and just grin and suffer timeout problems and constant crashes when building views.

  • Use the model project with the .edmx file and use the Power Tools Beta 3 Beta 3 context menu "Create Views" and resolve the namespace or view problem detection.

Please help me figure out one of these three ways and make it work.

Thanks Blake

+4
source share
3 answers

Have you checked the connection string?

This article should help explain your problem: http://thedatafarm.com/blog/data-access/entity-framework-power-tool-tips-to-view-model-a-feature-i-depend-on

+1
source

OK. I had this problem while trying to view the View Entity Model in the power tool tool menu. The sequence contains no elements. It looks like it is still being built using beta tools 3. The reason is that power tools cannot find the connection string. In any case, these are temporary solutions that work.

Add a new class library project to your solution. You can remove the default class 1 if you want. Now add the App.config file with the connection string element. (I just copied mine from the real App.config. Then set this project as the “Launch” project. Now, when you click on the View Entity Model as a read-only menu item, it will be displayed.

I think the guys are working on this problem. Julia Lerman reported this in the link mentioned above.

Hope this solves some of your problems.

+2
source

There was the same problem, but a different reason. Context: EF used with Oracle database

One of the columns was compared to the CLOB column type, which EF Power Tolls did not like, although when working with the EF database, it was not possible to use it without problems.

 Property(l => l.MyField).HasColumnName("MY_FIELD").HasColumnType("CLOB"); 
0
source

Source: https://habr.com/ru/post/1492365/


All Articles