Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

"Ambiguity between X and X" for every property after modifying entity model [closed]

I'm getting "Ambiguity between 'XYZ.EntityX.PropertyX' and 'XYZ.EntityX.PropertyX'" errors on every reference to properties in my entity model after making a small change to it and attempting to recompile. Both properties are identical in every case. There are also a lot of "The type 'XYZ.EntityX' already contains a definition for 'PropertyX'". Has anyone run into anything like this before?

I recently put the code into source safe, which I'll take a wild guess and say may have something to do with it. Maybe it cant update a file that's not checked out and also isnt prompting about it? I have no idea.

All I did was go into XYZModel.edmx, select a table, add a scalar property (string, 50 chars, nullable) and recompile. Everything worked until then. It also happens when I 'Update model from database'. I'm guessing any change at all to the model will cause it.

like image 713
user1566694 Avatar asked Mar 27 '13 18:03

user1566694


2 Answers

Just had the same error just now and i found out that i had copied classes to a new folder and not changes their names.

I have a Folder name Group and City, i then copied classes from Group to City when Group and City folders are referenced on the appservice i'm getting errors from.

like image 81
Shonie Avatar answered Jan 01 '23 19:01

Shonie


I had the exact same problem in Visual Studio 2015 but I used TFS instead of Sourcesafe.

First option is to make sure you are connected to your Source Control (Online).

If that doesn't work

  1. Make sure your Visual Studio solution is connected to TFS/Source Control. This issue can occur when your offline mode. Right click on the solution and select Go Online if your offline.
  2. Once your online connected to TFS in Visual Studio right click on the edmx and select Goto Source Control->Undo Pending changes. This will undo all the pending changes for the edmx and the associated generated files.
  3. Delete the changed table from the edmx and add it again.
  4. Build your solution
like image 37
dfmetro Avatar answered Jan 01 '23 19:01

dfmetro