部分类错误中的部分方法(现在有屏幕截图!) [英] Partial method within partial class error (now with screen shots!)
问题描述
我的部分方法出错,我不知道为什么.我认为常见的错误与两个部分类的命名不完全相同以及不完全相同,但这里的情况并非如此.
I'm getting an error on my partial method and I'm not sure why. I figure common errors relate to not naming the two partial classes exactly the same and what not, but that's not the case here.
所以,我有一些生成的代码,可以在这里看到:
So, I have some generated code, which can be seen here:
好吧,这还不是全部,但我认为这是相关的部分.
Well, that's not all of it, but I think it's the relevant part.
所以,我想创建另一个分部类,以便我可以容纳这些分部方法并让它们具有一些功能.因此,我创建了一个类并仅添加了其中一个功能(如此处所示)以进行测试:
So, I wanted to create another partial class so I could house these partial methods and get them to have some functionality. So, I created a class and added just one of the functions, as can be seen here, to test:
现在,当我在线阅读指南时,这应该可行.我的意思是显然我还没有完全理解,但我不知道.哦,顺便说一下,这是错误:
Now as I've read the guides online, this should work. I mean obviously I've not understood everything, but I don't know. Oh, here's the error, by the way:
我想这有点难以阅读.它说,
I guess that's a little hard to read. It says,
没有找到用于实现部分方法声明的定义声明WCFServiceSQLAccess.DomainContext.HydraDomainDontext.UpdateClients (WCFServiceSQLAccess.DomainContext.Client)
.
No defining declaration found for implementing declaration of partial method
WCFServiceSQLAccess.DomainContext.HydraDomainDontext.UpdateClients (WCFServiceSQLAccess.DomainContext.Client)
.
希望你能提供一些建议.
Hopefully you can offer some suggestions.
推荐答案
这很简单 - 您有两个不同的类:HydraDomainContext
和 HydraDataContext
.要么更改生成的类的名称,要么更改手动编写的类的名称 - 它们必须匹配才能创建一个完整的类,其中部分方法实现与声明匹配.
It's very simple - you've got two different classes: HydraDomainContext
and HydraDataContext
. Either change the name of the generated class, or the name of the manually-written class - they'll have to match in order to create one complete class with the partial method implementation matching the declaration.
这篇关于部分类错误中的部分方法(现在有屏幕截图!)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!