12

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

2
  • I know this is an old question but I would really like to know the answer too. If I find the answer I will post it here. Commented Oct 3, 2009 at 17:58
  • 1
    What database are you trying to connect to? Commented Oct 5, 2009 at 15:15

4 Answers 4

1

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.

Sign up to request clarification or add additional context in comments.

Comments

0

Try turning on the include exception faults behaviour

namespace DataService { [System.ServiceModel.ServiceBehavior(IncludeExceptionDetailInFaults = true)]

public class mydataservice : DataService<DataContext>
{
    blah blah

1 Comment

I voted this answer down for I can't see what this got to do with the Entity Framework. The example seems to come from Astoria/ ADO.NET Data Services.
0

I had similar issue. Look for similar names and missing mapping of forgen keys

Comments

0

I have had the same exeption, in my case it was my db(MySql) that had a table without a primary key, I just added a column "ID" and made it the primary key and voila! the exeption was gone :)

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.