Service reference - why reuse types in referenced assemblies
Asked Answered
M

1

18

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?

Mandorla answered 21/10, 2016 at 9:34 Comment(0)
G
19

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

  1. Why would I want to reuse types?

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

  1. What does that mean exactly?

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.

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

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.

Gentilesse answered 3/4, 2018 at 14:37 Comment(1)
I have been seeing XmlSerialization errors when having multiple ServiceReferences in the same project that contain the properties with the same name, namespace etc. I think this might also prevent those from popping up.Veloz

© 2022 - 2024 — McMap. All rights reserved.