开发者

Domain Service vs WCF Service?

开发者 https://www.devze.com 2022-12-14 02:02 出处:网络
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.

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.


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


Here is what I've found after searching:

http://42spikes.com/post/-Using-WCF-RIA-Services-with-your-POCO-Part-4-Returning-a-Simple-POCO-from-RIA

0

精彩评论

暂无评论...
验证码 换一张
取 消