Home  >  

Silverlight and ADO.NET Data Services

Author photo
| | Comments (3)
AddThis Social Bookmark Button

SIlverlight 2 allows you to talk to RESTful services as well as SOAP based services. You can pass/consume XML or JSON with these web services too. All stuff we would expect at some pointto expose a basic domain entity model for business applications. Microsoft also has a technology called ADO.NET Data Services (codenamed Astoria). I still like the Astoria nickname as its easier to say and in my opinion the title "ADO.NET Data Services" implies a heavy connection to a data layer. While there is some truth to that, the reality is that Astoria simply exposes a domain entity model through a RESTful model over HTTP. The model could have nothing to do with ADO.NET. In fact the model could be any entity model written in .NET code as long as it exposed IQueryable. This means that a standard class library in .NET code can be exposed through a RESTful set of web services over HTTP using Astoria very easily.

The beauty of Astoria is that it exposes the model without having to write dozens or hundreds of service methods to do so. Instead, it exposes the model thorugh a series of unique URI's that are mapped to the domain entities. For example http://mydomain/myservice.svc/customer(101)/orders?orderby=orderdate could return a list of orders for the customer with an ID = 101 sorted by order date. The data can be returned as XML or JSON, too. No service is written on the server side to handle this specific action, instead Astoria handles the mapping to the entities and offers a set of operators such as orderby and filter that can massage the data. Its a pretty slick concept overall, especially for those who love REST. The advantage here is that you don;t have to write a lot of RESTful web service methods to do this, since Astoria does that work for you iunder the covers.

Calling Astoria ... this can be done through any HTTP web request by passing a URI. Or, if you use Silverlight 2, you can use the Silverlight client library for Astoria which allows you to write a LINQ query to operate on the entities using the LINQ query syntax. the query is examined by the client library and turned into the URI / HTTP request. So in the end it works the same. The client library just allows a developer to make a simple request using the well known LINQ syntax if available.If you don;t want to use LINQ, you can still make a standard HTTP web request, too. There are lots of options, which is always good!

Read more from John Papa. John Papa's Atom feed John_Papa on Twitter

Comments

3 Comments

It is not so ease to learn how ADO.NET Data Services works together with Silverlight but it is a great experience. Do it!

Frank said:

I am having a difficult time with Silverlight ADO ..
The latest question is when I try to add a table to the datamodel and then update the service reference, I get a error message saying the server, local host etc etc etc refuses ..

any thoughts?

John Papa said:

Where you able to add the service ref in the first place and compile it and run it OK? If so, then try removing the service ref and re-add it. If you could never get it to work, make sure the service runs on the same domain as the silverlight client's web host. ADO.NET Data Services only works on the same domain right now ... no cross domain capabilities yet (for a variety of reasons they are working out). For example, if your service is on http://localhost:1234 and your web site hosting silverlight is on http://localhost:6789, it will not work. They both need to be on the same domain.

Leave a comment


Type the characters you see in the picture above.

Tag Cloud

Poll: Sci-Fi Movies

What's Your Favorite Sci-Fi Movie of All Time?

Vote | View Poll Results | Read Related Blog Entry

Latest Features

  •     Welcome back to the series. This time we are goings to build a really exciting component that will be used to simply display information about the user. Well, you might say why to we need such a component, is there... Continue Reading
  •    Welcome back to our exciting Facebook ActionScript series. In this article we will discuss one of most important (and most exciting) features of the FB platform, it's the publishing of news. We all know when we log in to facebook,... Continue Reading
  • This article provides 10 tips and best practices (in no particular order) for maximizing the benefits that Dojo can bring to your next project. For a more thorough introduction to Dojo, see the article Dojo: The JavaScript Toolkit with... Continue Reading
  •     The notifications are one of the most interesting (and important) parts of the facebook area. In order to completely understand the Flash side of it, we need to understand the basics of the facebook notification, what it is and how... Continue Reading

Development Series

Get an overview of the tools and technologies that work together to allow developers to build Rich Internet Applications (RIAs) quickly and easily.

facebook icon Facebook Application Development

Anatomy of an Enterprise Flex RIA

Recommended for You

@InsideRIA on Twitter

Archives

  • Or, visit our complete archive.  

About This Site

Welcome to the premiere community site for all things RIA sponsored by O'Reilly Media and Adobe Systems Incorporated.