Partial class does not correspond to auto-generated part of class

I created an entity model for my DB classes, here is one of them:

[EdmEntityTypeAttribute(NamespaceName="SotiModel", Name="SKUPrice")] [Serializable()] [DataContractAttribute(IsReference=true)] public partial class SKUPrice : EntityObject { ... } 

and created a partial class for one of them

 public partial class SKUPrice { } 

The problem here is that the "partial" world is written in a "light" color, and resharper suggests: "a partial class with one part . "

It seems that my "own" part of the partial class does not match the "main" part ...

Why? How to fix it?

Thank you so much!

PS I work in VS2010, under Windows7 (64 bit)


I don’t know what the problem really is, but for some reason, if I copy / paste the source code of a class from one file to another and after that rename the class name and the name of the metadata class name - this does not count as' Visual Studio as valid class.

If I delete a file with this "broken" class and TYPE EVERYTHING manually from scratch - the file is accepted by the studio ...

A strange and stupid thing ... but that ...

If you know why this is happening, let me know.

Thanks.

+8
c # entity-framework resharper partial
source share
5 answers

Each class definition must be in the same namespace for proper matching.

+21
source share

There was a similar problem. Try restarting Visual Studio.

+4
source share

That sounds silly, but try entering the namespace manually.

My problem is similar to yours, and after adding a space after the namespace, resharper will magically recognize the partial class. I tried to remove the space and it still works. In short, the source code file is almost the same, but they are processed differently just because the namespace has some kind of manual input or not.

Sounds like a VS error to me.

+3
source share

I have the same problem and I solve it by abandoning resharper 6.1 to 6.0 and everything works fine. If you are using resharper, try removing it temporarily.

0
source share

I know it has been a while, but I just ran into this problem and I noticed that my x:Class="NAME" does not match the NAME file. I also copied and pasted, but at first I forgot to make this change. When matching names, all the problems that I had were fixed.

0
source share

All Articles