views:

46

answers:

1

Is it possible for me to connect to my own data provide via WCF RIA services?

I've created a small datalayer that connnects to DynamicAX datasource. I would like to use Silverlight 4 & RIA service to access that datalayer.

At it's most basic -I've done the following...

1) I've added an empty domainclass to the webproject and in that class I created a simple method to return a string...

[EnableClientAccess()]
public class ProjectService : DomainService
{
    public string TestViaRIA()
    {
        return "Hello!";
    }
}

2) I then added reference to the web project in my silvelight class and created a bit of code to try and invoke the method...

using ProjectApp.Web;
namespace ProjectApp.Views
{
    public partial class ProjectControl : UserControl
    {
        public ProjectControl()
        {
            InitializeComponent();

            ProjectContext ctx = new ProjectContext();
            var x = ctx.TestViaRIA();
            testTextBox.Text = x.ToString();
        }
    }
}

the returned value is "{System.ServiceModel.DomainServices.Client.InvokeOperation}".

I'm obviously doing something wrong here and I would appreciate some guidance on how I can achive this.

Thanks in advance

A: 

Add [Invoke] attribute on the method

lee