Could not find the conceptual model type

五迷三道 提交于 2019-12-03 01:45:17

Solution found. It appears in some cases (randomly) there is a mix up in the code generated by the entity framework. This is apparently a known bug and a fix should be coming in future releases. In the mean time the way around this is to move the efm to a separate class within the solution.

Solved this by updating EntityFramework to the latest version (6.0) http://nuget.org/packages/EntityFramework/.

After installing it regenerate the models and it will work ;)

I had the same problem with 2 different .edmx files in the same project. For the first .edmx model I had used "Add Code Generation Item", for the second model I hadn't. The project was building correctly but throwing that exception on runtime.

I solved generating the .tt classes for the second .edmx model as well.

One possible explanation is that if you use the database first approach and forget to add the Entity classes, you will get this error.

i.e. (from the guide linked below)

  1. Right click on the model’s designer surface.
  2. From the context menu, choose Add Code Generation Item.
  3. In the Add New Item dialog that opens, select Data from the list of installed templates types on the left.
  4. Choose the ADO.NET DbContext Generator then click the Add button.

I normally use Julie Lerman's guide; https://msdn.microsoft.com/en-us/library/jj206878(v=vs.113).aspx

Well I just installed EF 4.1 and tried to combine DbContext with a EMDX - When I tried to pass back a view I got the same error - that's why I ended up here... I think the way around this is to separate the functionality out into separate asemblies in the solution...

This can also be resolved by generating the new edmx in visual studio 2010 so it matches the older ones... (And copying over the files it generates)

Using Visual Studio 12, the issue has still not been resolved. As an alternative workaround, I set up the second SQL data model using "old fashioned" Data Classes that pre-date entity models - they're still there and they still work. Use Add - New Item - (Data Category) - LINQ To SQL Classes, open the ServerExplorer, locate the server and database, then drag and drop it onto the data classes pane. Old school - but conveniently overcomes this highly inconvenient issue when the full functionality of entity models is not needed.

I removed the edmx models, removed the Entity package, re-install the entity 5.0 and works.

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