1

I have an entity framework model, and I noticed that one table, a usergroup table is missing from the diagrams in the model file. This meant I could not modify it from the standard SQL calls to become part of the entity framework (i.e., to make a class file for it with entities).

I can see it under "entity sets" but not in the diagram. Every time I try to add, it doesn't show it as an option to add in the "update model" menu. So I deleted it from Entity set, and then I finally saw it in 'update model'. I added it. Still won't show up on diagram (it just puts it as Entity Set, but doesn't make a diagram for it).

After getting frustrated with it, I figured there was some foreign keys preventing it from being added. So I went to my sql manager, and deleted any foreign key from usergroup table.

So now, when I add in the model, it appears in the diagram! YES!

BUT, now compiler error 3002 saying models don't match. "Potential runtime violation of table" saying the mapping is incorrect, but I don't understand---there is no mapping there, there is nothing linking usergroup to anything.

Why is this happening? I checked other foreign keys and mapping properties and nothing maps to usergroup. Is it a bug in Visual Studio 2010?

2
  • That mapping probably refers to the mapping from conceptual model to the physical storage model - the trilogy of CSDL, MSL, SSDL files, that maps the physical SQL Server table to your model entity. I don't think it refers to anything having to do with a foreign key.... Commented Mar 1, 2011 at 21:30
  • The reason why it didn't show up is it may contains the computed column or column with customized type. Commented Mar 2, 2011 at 16:10

1 Answer 1

1

It is probably that the sections of the edmx file are out of sync or maybe parts are corrupt.

You could try opening the edmx file in a text editor and check for any errors.

You could also try removing that table, then opening the edmx file in a text editor and make sure that all references to that table have been removed.

The mapping error is not between tables, it is between parts of the edmx file.

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

1 Comment

Wow well that worked very smoothly this time. I first removed all the usergroup references in the file with notepad++. Saved. Then I re-added the tables and everything compiled. Thanks! Very odd that visual studio allows things to become unsynced and doesn't fix them automatically.

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.