John Smith
John Smith

Reputation: 11

RIA Service's method always returns null. How to resolve it?

I have a RIA Service and I need to use some of the methods in a silverlight app. Here is how the sample RIA Service's method looks like:

    [Invoke]
    public string TestService()
    {
        return "good!";
    }

And here is one of the ways how I tried to use it in a silverlight app:

           var ctx = new MyDomainContext();


           public string str;
           ctx.TestService( (i) =>
           {
               if (!i.HasError)
               {
                    str= (string)i.Value;

               }
           }, null);

And for some strange reason I always get null; Please advise.

Upvotes: 1

Views: 203

Answers (1)

Yerzhan
Yerzhan

Reputation: 11

str must be global not variable

private string Str { get; set; }

Upvotes: 1

Related Questions