ServiceContractAttribute.CallbackContract Property

Gets or sets the type of callback contract when the contract is a duplex contract.

Namespace:  System.ServiceModel
Assembly:  System.ServiceModel (in System.ServiceModel.dll)

public Type CallbackContract { get; set; }

Property Value

Type: System.Type
A Type that indicates the callback contract. The default is null.

Specify an interface in the CallbackContract property that represents the required opposite contract in a two-way (or duplex) message exchange. This enables client applications to listen for inbound operation calls that the server-side service application can send independently of client activity. Callback contracts that have one-way operations represent calls from the service that the client can handle.


//The following code contains an example of a duplex contract that contains a callback contract.
[ServiceContract(
    Name = "SampleContract", 
    Namespace = "Silverlight", 
    CallbackContract = typeof(IDuplexClient))]
public interface IDuplexService
{
    [OperationContract(IsOneWay = true)]
    void Order(string name, int quantity);
}

[ServiceContract]
public interface IDuplexClient
{
    [OperationContract(IsOneWay = true)]
    void Receive(Order order);
}


Silverlight

Supported in: 5, 4, 3

Silverlight for Windows Phone

Supported in: Windows Phone OS 7.1, Windows Phone OS 7.0

XNA Framework

Supported in: Windows Phone OS 7.0

For a list of the operating systems and browsers that are supported by Silverlight, see Supported Operating Systems and Browsers.

Community Additions

ADD
Show: