服务引用可以重用添加引用的程序集中的类吗?

发布于 2024-10-10 14:48:12 字数 500 浏览 0 评论 0原文

如果我想要重用的类位于另一个程序集中,那么我没有问题。

但是,如果我想向包含类的程序集添加服务引用,我希望重用该服务引用,则它们不会被重用。我怀疑它与它的工作方式有关,正如所指出的此处

服务引用代码生成器无法识别重用类型,除非引用的程序集包含已构建并在磁盘上的重用类型。

显然,由于我添加引用的程序集也包含类,因此无法按原样在磁盘上为代码生成器进行编译。这是一种第 22 条军规。但是,是否有一种简单的方法可以实现此目的,而无需手动创建服务引用或为我的模型使用卫星程序集?

If the classes that I want to reuse are in another assembly, I don't have a problem.

But if I want to add a service reference to an assembly that contains classes I would like the service reference to reuse, they don't get reused. I suspect it has something to do with how it works, as pointed out here:

The service reference code generator is unable to recognize the re-used types unless the referenced assembly that contains the re-used types is built and on the disk.

Obviously as the assembly I'm adding the reference to also contains the classes then it can't be compiled on the disk as-is for the code-generator. It's a sort of catch-22. But is there a simple way to achieve this without manually creating a service reference or using a satellite assembly for my models?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

苏佲洛 2024-10-17 14:48:12

我解决了!有时经过一段时间的思考,在这里写出来会让你以不同的方式思考......无论如何,我目前的解决方案是在另一个程序集中生成服务引用,然后将其复制并更新命名空间。简单的!

I solved it! Sometimes after a while of thinking, writing it out on here makes you think differently somehow... anyway, my solution at the moment is to generate the service reference in another assembly and just copy it across and update the namespace. Simple!

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文