PrepAway - Latest Free Exam Questions & Answers

Which code segment should you insert at line 01?

You are creating a Windows Communication Foundation (WCF) client application by using Microsoft .NET Framework 3.5.
The proxy generated for the WCF service results in the following code segment.

[ServiceContract(CallbackContract=typeOf(IStoreCallback))]
public interface IStore
{
[OperationContract(IsOneWay=true)]
void CheckAvailableProducts();
}
public interface IStoreCallback{ }

To implement a callback interface, you create the following class in the client application.
public class StoreCallback: IStoreCallback{ }
The client application receives notifications from the service through the callback interface.
You write the following code segment for the client application to use the generated proxy.
(Line numbers are included for reference only.)

01
02 client.CheckAvailableProducts();

You need to set up duplex communication between the client application and the WCF service.
Which code segment should you insert at line 01?

PrepAway - Latest Free Exam Questions & Answers

A.
StoreClient client = new StoreClient( new InstanceContext(typeOf(StoreCallback)));

B.
StoreClient client = new StoreClient(OperationContext.Current.InstanceContext);

C.
StoreClient client=new StoreClient(new InstanceContext( new StoreCallback()));

D.
IStoreCallback callback = OperationContext.Current.GetCallbackChannel<ServiceReference.IStoreCallback>();
InstanceContext context = new InstanceContext(callback);
StoreClient client = new ServiceReference.StoreClient(context);


Leave a Reply