Friday, June 25, 2010

ODATA

After attending the OData roadshow in Chicago a few weeks ago I have been inspired to learn and practice OData. After some absence from the blogging world, I decided to write some entries about my experiences.

My very first comment about OData--it is awesome, exposing data with ease, improving and streamlining application development.

I also have done some work with RIA (domain services). During my learning cycle I found that a RIA domain service can also be exposed as Odata. When creating the domain service be sure to check "Expose OData endpoint" check box.

Then through the browser you can access the domain service as an odata endpoint.

It took me awhile to actually get this to work, as most of my problems were syntax related.

Here is what I learned: to access an OData endpoint that is a RIA domain service in a Silverlight project (4.0) the following should work:

If your Silverlight Web project is named: SilverlightApplicationSimpleRIA.Web

Then the link to access the OData endpoint is:
http://localhost:2551/SilverlightApplicationSimpleRIA-Web-DomainServiceNW_RIA.svc/OData/

Notice
1) . (period) is replaced with a - (In web project name)

2) appended to the project name SilverlightApplicationSimpleRIA-Web is a - and then the name of the Domain Service (as defined in the Web project), followed by .svc, followed by a /
i.e. SilverlightApplicationSimpleRIA-Web-DomainServiceNW_RIA.svc/
Be aware that the "silverlight web" project has no .svc file defined, this is constructed "virtually" for a domain service

3) then add OData/ (the syntax here caused me a bit of a problem--OData is case sensitive -- also do not forget the ending / (if you do you'll probably get endpoint not found message when doing the access)

I tested this with IE 8 along with Silverlight 4, and it worked like a champ.

0 Comments:

Post a Comment

<< Home