Click here to Skip to main content
15,884,014 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
[DataContract(Name = "PublishToDataContract")]
public class PublishToDataContract
{
    [DataMember]
    public readonly string PublishToAddress;
    [DataMember]
    public readonly string FaultAddress;
    [DataMember]
    public readonly string MethodId;
}


This is my code for a Datacontract. It is in the same namespace as my service contract.

When I add the ServiceReference to the client, the Service contract is visible, but not the datacontract.

Any ideas?
Posted

1 solution

Do you have a method in your service that exposes your 'PublishToDataContract' class? If not then this is why the proxy class in your client doesn't contain the definition.

Try this - In the interface of your WCF service (And then implement it)
C#
[OperationContract]
void ExposeContract(PublishToDataContract item);

This will expose the publish to data contract to the client.

Bear in mind that this is a bit of a fudge Smile | :)
 
Share this answer
 
v3
Comments
Ger Hayden 25-Nov-12 13:21pm    
Hi,

No - And I cannot see where it is done in Dennis Van der Stelt's example. I can see him use it as as parameter to a method but not exposed in its own right.
Ger Hayden 25-Nov-12 13:43pm    
I have made this change with no improvement:
<pre>
public string PublishToAddress { get; set; }
</pre>
Ger Hayden 26-Nov-12 3:54am    
Perfect. This DC is only to be used to supply various comms details on the message header rather than mixing them in with the business data that will be exchanged. The body of the implementing method is just ";" but that is all that is needed in this case!

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Top Experts
Last 24hrsThis month


CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900