I have a Silverlight site with wcf ria services, this is just a test.
The service is as follow
[EnableClientAccess()]
public class PersonService : DomainService
{
[Invoke]
public string[] GetPersonNames()
{
return new string[] { "abc", "cba", "ddd", "ttt" };
}
[Invoke]
public string GetName()
{
return "teste";
}
[Invoke]
public string Test(string str)
{
return str;
}
}
I have a xaml page where I call the service
SLRiaTest.Web.PersonContext person = new SLRiaTest.Web.PersonContext();
public MainPage()
{
InitializeComponent();
person.GetPersonNames(OnFinished,null);
}
private void OnFinished(InvokeOperation<string[]> obj)
{
var list = obj.Value;
}
but the Value is always null and the break point that I have in the serice never gets hit. I search the internet high and low and can’t find anything that might tell me what I’m doing wrong, any help would be great, I’m desperate…. I suppose that I can use RIA service without entity framework right?
The details on what does and does not work for calls across the wire in RIA Services are complex. If you want a detailed answer on what is going on here, you’ll have better luck asking on the RIA Services forum
However, you’re kind of going against the design of RIA Services. If you want to return a collection of objects, you should use Query instead of Invoke.
I just did that off the top of my head so might have some minor errors. But that’s the general idea.