部分类不匹配自动生成的类部分 [英] Partial class doesn't match to auto-generated class part

查看:172
本文介绍了部分类不匹配自动生成的类部分的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我创建的实体模型,我的数据库类,这里就是其中之一:

I've created 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 partial class for one of them

public partial class SKUPrice
{
}

这里的问题是,部分世界是用光的颜色和ReSharper的建议:的部分有一个零件类

这似乎是部分类的我自己的一部分是不相匹配的主要部分...

It seems like my 'own' part of partial class is not matched to the 'main' part...

为什么呢?如何解决呢?

Why? How to fix that?

非常感谢!

P.S。我在VS2010的工作,在Windows7的(64位)

P.S. I'm working in VS2010, under Windows7 (64bit)

我不知道什么是真正的问题,但由于某些原因,如果我从一个文件复制/粘贴类源$ C ​​$ C到另一个,之后改名类名和元数据类名的名字 - 这是不是由Visual Studio为有效类的考虑。

I don't know what is actually a problem, but due to some reason if I copy/paste class source code from one file to another and after that rename class name and name of metadata class name - that is not 'considered' by Visual studio as valid class.

如果我删除的文件与破类,manualy TYPE一​​切从头开始 - 文件是由工作室接受...

If I delete file with that "broken" class, and TYPE EVERYTHING manualy from scratch - file is accepted by studio...

奇怪的和愚蠢的事情......但......

Strange and stupid thing... but it is...

如果你知道为什么会发生 - 请让我知道

If you know why it happens - please let me know.

感谢。

推荐答案

每个类的定义必须在同一个命名空间对它们进行正确的匹配。

Each class definition must be in the same namespace for them to be correctly matched.

这篇关于部分类不匹配自动生成的类部分的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆