locked
WCF async pattern with tasks and cancellation RRS feed

  • Question

  • With .NET 4.5 I can define a service contract like this:

    [ServiceContract]
    interface IMyService
    {
      [OperationContract(Name = "Op")]
      Task<MyReturnType> OpAsync();
    }

    What about cancellation? Is the following possible?

    [ServiceContract]
    interface IMyService
    {
      [OperationContract(Name = "Op")]
      Task<MyReturnType> OpAsync(CancellationToken cancellationToken);
    }

    Saturday, November 3, 2012 4:44 AM

All replies