服务引用之间的ASP.net重用类型 [英] ASP.net re-use types between service references

查看:34
本文介绍了服务引用之间的ASP.net重用类型的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有两个服务引用,分别通过为每个服务导入WSDL导入到asp.net项目中。第一个参考是Web服务(Acumatica)中的默认参考,第二个参考是我在原始Web服务中创建的自定义终结点服务。

I have two service references that I am importing into my asp.net project by importing a WSDL for each. The first reference is a default reference from my web service (Acumatica) and the second is a custom endpoint service I created in the original web service.

问题是,它们两个都在其对象类中使用相同的基本类型,因此当我同时包含两个名称空间时,可以在代码中使用它们中的对象,我收到一个错误消息,说两个名称空间中的基本类型之间存在不明确的引用。说得通。但是,我该如何进行设置,以使.net知道在两个命名空间之间完全相同的基础类型呢?

The problem is that both of them use the same "base types" in their object classes so when I include both namespaces to use the objects from both of them in my code, I get an error saying there ambiguous references between the base types in the two namespaces. Makes sense. But how can I set this up so that .net knows to re-use the base types between the two namespaces since they are exactly the same?

显示我的意思是m在谈论:

To show what I'm talking about:


您可以看到引用之间的类型完全相同。我可以配置这些引用以在两个引用之间重用这些类型,以消除模棱两可的引用错误吗?

You can see there are types that are exactly the same between the references. Can I configure these references to re-use those types between the two of them to get rid of my ambiguous reference errors?

推荐答案

不幸的是,无法实现所需的目标。

Unfortunately, there's no way of achieving what you want.

问题是,使用的基类不同(它们具有不同的属性这导致了不同的XML(反序列化)。为了增加侮辱性伤害,在研究此问题时,我们发现您用来生成客户端代码的WCF客户端实用程序使用XMLSerializer时不支持重用,因此,即使Acumatica使基类完全相同,客户端上也不会有任何重用。

The thing is, the base classes used are not the same (they have different attributes which leads to different XML (de)serialization). To add insult to injury, when we researched this issue, we've found out that WCF client utility which you use to generate client-side code does not support reuse when XMLSerializer is used, so even if Acumatica made the base classes exactly the same, there still wouldn't be any reuse on client.

但是为什么需要同时使用不同的端点?如果您自己的端点仅向Acumatica的 Default 添加功能,为什么不考虑扩展 Default ?这样,您只需要在代码中使用一个端点即可。

But why do you need to different endpoints simultaneously? If your own endpoint is only adding functionality to Acumatica's Default, why not consider extending Default? This way you'd need only one endpoint in your code.

这篇关于服务引用之间的ASP.net重用类型的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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