开发者

Async CTP call a wcf ria service method that returns a string value

I'm trying to implement the following into my silverlight wcf ria services project.

http://blogs.msdn.com/b/kylemc/archive/2010/11/02/using-the-visual-studio-async-ctp-with-ria-services.aspx

It is working fine for entities. However I'm trying to write a custom method that returns a string and throws an error.

Custom metho开发者_Python百科d

    public string GetHello(string str)
    {
        return ("Hello " + str);
    }

Calling from Client

String str;

str = await context.LoadAsync(context.GetHello("Sam")).ToString();

Error:

The 'await' operator requires that its operand 'System.ServiceModel.DomainServices.Client.InvokeOperation' have a suitable public GetAwaiter method


You need to call AsTask to convert the InvokeOperation to a Task.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜