0

I have web service (wcf c#) that uses entity framework.

It worked perfectly, but I updated the model and now I get error:

class is an ambiguous reference between NameSpace1.Class and NameSpace2.Class.

I work in visualStudio 2012, and it suggests to change the type to NameSpace1.Class or NameSpace2.Class (Class is my class name and NameSpace1/2 are my namespaces names)

I choose the type I want - NameSpace1.Class, but then I get error:

The type or namespace name 'NameSpace1' does not exist in the namespace.

but I dont understand - It does exist. and vs itself suggested me to choose it.

I tried everything: rebooting vs, cleaning and rebuilding the solution, and even rebooting my computer, but nothing helped.

maybe the error is wrong?

edit

well, the error comes from this line:

public IEnumerable<MyClass> GetMyClassList()  

the options are: NameSpace1.MyClass or NameSpace2.MyClass.

I Click on the first, and it changed to:

public IEnumerable<NameSpace1.MyClass> GetMyClassList()  

and then get error :

The type or namespace name 'Class' does not exist in the namespace 'Bll.NameSpace1'.

I think, that maybe the error occures because I have the namespace NameSpace1 twice: one in Bll.NameSpace1 (Bll is my current project) and the second in Reference with the name NameSpace1.

Community
  • 1
  • 1
Rachel Fishbein
  • 818
  • 2
  • 12
  • 29
  • 4
    *maybe the error is wrong?* very unlikely. It would help if you could post the relevant code. – Dirk Nov 05 '14 at 12:57
  • 1
    what `using` statements do you have at the top of the code file? Are `NameSpace1` and `NameSpace2` the real names? If so, just change them to something *meaningful*. – hometoast Nov 05 '14 at 13:15
  • 2
    Yes your edit makes sense. That is the point of namespacing - as far as possible they should be unique. I would try to rename `Bll.NameSpace1` to something more related to what is actually inside it, such as `Bll.BusinessEntities` – Rhumborl Nov 05 '14 at 13:16
  • Sometimes Visual Studio gives errors that aren't really errors. Try rebooting Visual Studio and if that doesn't help reboot your pc. Additionally, clean your solution. – Erwin Nov 05 '14 at 13:19
  • 1
    thank you all. @Erwin, I mentioned I have done everything like rebooting and cleaning. – Rachel Fishbein Nov 05 '14 at 13:27
  • I did what you, @Rhumborl, and that was the solution. thanks again! what I don't understand is why it occured suddenly after updating the model - it has worked perfectly before. – Rachel Fishbein Nov 05 '14 at 13:29

0 Answers0