Service reference - why reuse types in referenced assemblies

回眸只為那壹抹淺笑 提交于 2019-12-06 20:25:37

问题


I'm following instructions to add a service reference to my project and, by default, the "reuse types in referenced assemblies" is ticked.

If I leave it ticked, I get ambiguous warnings on controls like Label, which I have to declare fully now.

If I untick it, the warnings go away.

My questions are:

  1. Why would I want to reuse types?

  2. What does that mean exactly?

  3. What are the problems if I don't use it?


回答1:


I know I'm answering like two years late, but...

1- To avoid having two classes with the same name, types, etc.

2- It means that, if you control both the server code and client code and define the datacontract classes in a separate assembly (and add a reference to it in the client code), the svcutil will not generate new classes but instead will re-use your already-defined classes that you use for the server.

3- Generally none if you 1) do not control the server code or 2) specify full namespaces for everything. You may get ambiguous warnings if you're in the same solution for server and client code.



来源:https://stackoverflow.com/questions/40173147/service-reference-why-reuse-types-in-referenced-assemblies

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!