开发者

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

开发者 https://www.devze.com 2023-04-08 06:57 出处:网络
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

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

精彩评论

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

关注公众号