开发者

WCF Data Services vs OData MVVM

开发者 https://www.devze.com 2023-04-05 14:51 出处:网络
I have only had practical experience with plain WCF services and WCF REST services but as needs changed I need to look at other options....

I have only had practical experience with plain WCF services and WCF REST services but as needs changed I need to look at other options....

What is the difference between OData and WCF Data servcies?

Isn't WCF Data Services OData in .Net (It can be configured to return Atom feed or JSON etc)?

What if I wanted to do something more complicated than just CRUD?

For example when I make a Http request and get a response like below.

req = (HttpWebRequest)WebRequest.CreateDefault(new Uri(FCookieLocation));
HttpWebResponse resp1 = (HttpWebResponse)req.GetResponse();
Stream stream = resp.GetResponseStream();

I want to then do something like

while (true)
{
    byte b = stream.ReadByte();
}

But REST Services, as soon as you return from the method you wrote, terminate the response immediately. Is there a way to keep the stream alive at the server end so I can keep writing data to it and the client just keeps reading from it?

I know ASP.Net web handlers have something of such a feature, but in my case I may need to write my own webserver that listens on a socket for Http requests(so connection stays open) to achieve this and keep writing to the socket perhaps?

Sorry if the question isn't clear just the best way I c开发者_如何转开发ould explain it.

How is it best to use WCF Data Services to fit with the MVVM pattern?


To answer some of your questions:

  1. WCF Data Services is a technology (framework?) used to deliver data to clients. It uses the Open Data Protocol (OData) to deliver those results in a RESTful way. So WCF Data Services is the server (so to speak) and OData is the messaging schema/format.

  2. WCF Data Services is NOT OData in .NET. Again, OData is just the payload schema; WCF Data Services is the delivery mechanism.

  3. You can do something more complicated than just basic CRUD using WCF Data Services. Take a look at Service Operations in WCF Data Services -- they essentially let you enhance your service by providing specialized methods to do specific things. You can also provided additional WCF services and operations to enhance your solution.

I'm not sure about your other questions about streaming and MVVM...but I hope this at least is a start in the right direction.

Hope this helps!


Do you mean a constant stream over HTTP?

0

精彩评论

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