views:

423

answers:

1

Hi all,

Im slowly delving into Silverlight and after a good while trying I am finally able to return my own Custom Object from my web to my silverlight client, use a Siverlight enabled WCF service.

Now, im a little at a loss between the differences of a Domain Service, and a WCF Service.

Ive worked through the tutorials where a Domain Service is tied to a data context then bound to siliverlight controls. Great :) However, where i hit a rock was trying to return anything bar IQuerryable; as String, my own simple type etc.

I found a few tutorials such as this showing to mark a function with the [ServiceContract] annotation and to have a [Key] within your simple class. This didnt work, [ServiceContract] was not resolvable, and i later found a guide saying to use [Invoke]. I then hit issues of not been able to load the function and get a result, i basically go to here

[Invoke]
    public string HelloWorld(string name)
    {
        return string.Format("Hello {0}.", name);
    }


var helloWorld = new HelloWorldDomainContext();
        //helloWorld.HelloWorldCompleted += new EventHandler<InvokeEventArgs<string>>(HelloWorldHelloWorldCompleted);
        //helloWorld.HelloWorld("Mark Monster");

Anyway, so I then discovered silverlight enabled WCF services, and am able to return my own custom objects and call this fine.

tl;dr - Are Domain Services only for use when binding to Silverlight controls? Ie its kind of a direct one way binding and is called as and when is needed, and i do all Linq related sorting / filtering / selecting on the server?

And lets say I want to return an xmlString, then i use a WCF service? Am i right to be using a mix of WCF services and Domain Services in my application?

Sorry if the above is a bit confusing! Just trying to get to grips with this all coming from ASP.NET / Flex

Thanks muchly.

+1  A: 

This should clear things up: WCF RIA Services: Returning a Simple POCO from RIA

Mike Graham