Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>OK - default behavior for a WCF Service is this:</p> <ul> <li>you define your service contracts, operations, and data contract on the server (e.g. in namespace "Server.MyService")</li> <li>once the service is up and running, on your client, you create a service reference</li> <li>when doing so, what Visual Studio or <code>svcutil.exe</code> do, is interrogate that service for its metadata (description of service methods and data)</li> <li>based on that metadata, the client side proxy is generated (namespace "Client.MyService") and it contains replicas of the service contract (the methods) and the data contract</li> </ul> <p>Important: it contains <strong>replicas</strong> of those things! They look the same, and they serialize into the same XML format on the wire - but they are different - in different namespaces, most notably.</p> <p>This is the very nature of WCF - all you do is exchange <strong>serialized messages</strong> between client and server - all that goes back and forth are textual messages. Nothing more - no object references, no remote object - nothing like that. Toss that out of your mind! :-) </p> <p>If you control both ends of the wire, this can be a pain - if you need to change anything, you have to change it on the server side, update the client references and so forth.</p> <p>So if you control both ends of the wire - both the server and the client - and they're both .NET based, you can do the following:</p> <ul> <li>put your service contracts and your data contracts (only the contracts - no implementations!) into a separate assembly</li> <li>from your service implementation, reference that contracts assembly</li> <li>copy the contracts assembly to your client, and also reference it in your client project</li> </ul> <p>Now, if you add the service reference, by default, the <code>Add Service Reference</code> function in Visual Studio will reuse existing types in referenced assemblies - so if you have referenced your common "Contracts" assembly, those types (in their full glory, including their namespace) will be reused - no additional copies will be created.</p> <p>That way, you can create a single, shared contracts assembly used by both the server side code, as well as your client, and you don't have to mess with any duplication of data structures. But again: that only works if you are in control of both ends of the wire, and both are .NET</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload