Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Trouble creating new Entity Data Model

I'm trying to add a new ADO.Net Entity Data Model to an MVC project I am working on.

When I complete the wizard, choosing my db and tables (just a single table for now) I get an error ""Exception has been thrown by the target of an invocation." and it throws me back the add new item dialog.

At this point, an empty Data Model has been created in my project. If I then choose "Update Model From Database" and complete the wizard again, I get a similar error.

An exception of type 'System.Reflection.TargetInvocationException' occurred while attempting to update from the database. The exception message is: 'Exception has been thrown by the target of an invocation.'.

Any ideas? I have tried doing this in an empty project also and still no dice!

Alex

like image 831
Fergal Moran Avatar asked Jun 10 '09 15:06

Fergal Moran


People also ask

How do I add a new model in Entity Framework?

Right-click the Models folder in the Solution Explorer window and select the menu option Add, New Item. In the Add New Item dialog, select the Data category (see Figure 1). Select the ADO.NET Entity Data Model template, give the Entity Data Model the name MoviesDBModel. edmx, and click the Add button.

Which option should be chosen to create an entity model?

Thus, you can create an Entity Data Model file (. edmx) for your existing database. You can open an EDM designer in XML view where you can see all the three parts of the EDM: Conceptual schema (CSDL), Storage schema (SSDL) and mapping schema (MSL), together in XML view.


1 Answers

You could try creating the Entity Data Model manually using the EdmGen.exe tool. Hopefully that will give a bit more information about the error.

like image 198
cofiem Avatar answered Oct 04 '22 16:10

cofiem