Accessing my own datalayer using RIA & Silverlight

Posted by Norsten on Stack Overflow See other posts from Stack Overflow or by Norsten
Published on 2010-05-21T09:26:00Z Indexed on 2010/05/21 9:30 UTC
Read the original article Hit count: 193

Filed under:
|
|
|

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

© Stack Overflow or respective owner

Related posts about ria

Related posts about Silverlight