Tag Archives: OData

OQuery – A fluent API to build OData url queries sans LINQ

Yesterday, I blogged about a solution to compose OData / WCF Data Service queries using LINQ for situations where LINQ enabled client libraries don’t exist (i.e. JavaScript and Windows Phone 7).

http://blogs.msdn.com/b/devkeydet/archive/2011/02/02/data-services-odata-client-for-windows-phone-7-and-linq.aspx

The post is all about using LINQPad as a tool to write your LINQ queries, then using the feature in LINQPad that gives you the url query translation.  Well today, a new MSDN Code Callery project just popped up called OQuery that offers another approach that doesn’t require using an external tool such as LINQPad:

http://code.msdn.microsoft.com/oquery

Here’s the description from the project page:

“OQuery is a library which gives you a fluent style interface for building OData Url Fragments in javascript or C#.
Neither Javascript or Silverlight for WP7 support LINQ and so this library in those cases.”

What are you waiting for?  Go check it out!

Follow devkeydet on Twitter

Data Services (OData) Client for Windows Phone 7 and LINQ

 

The WCF Data Services Team released a client library to make it easier to interact with OData services from Windows Phone 7. 

http://bit.ly/wp7odatalib

The major caveat (and bummer) with the library is that “LINQ support in the client library has been removed as the core support is not yet available on the phone platform.”  I have a tip/trick for LINQ lovers like me that will allow you to still use LINQ query syntax to compose your query (kind/sorta).  A tool I find useful to when writing OData queries on Windows Phone 7 is LINQPad.  I use the tool to write LINQ queries against my data service, then get the url syntax query translated for me:

clip_image002

Once I get my LINQ query right, I just paste the http string into my app.  I’m still surprised about how many people aren’t aware of LINQPad.  You must check it out if you use LINQ in your day to day coding (which I am sure most of you do now).  You can learn more about using LINQPad against OData services (amongst many other uses) from the product site:

http://www.linqpad.net/

NOTE: This tip/trick is very useful when querying OData services from JavaScript as well.  Here are two helpful posts on using jQuery to interact with an OData service:

http://stephenwalther.com/blog/archive/2010/04/01/netflix-jquery-jsonp-and-odata.aspx

http://stephenwalther.com/blog/archive/2010/03/30/using-jquery-and-odata-to-insert-a-database-record.aspx

Hope this helps save you some time!

Follow devkeydet on Twitter

Open Government Data and Bing Map Apps

The Bing Maps team is running a King of Bing Maps contest.  Chris Pendleton just published a blog post on Bing Map App Development Resources over on the Bing Maps blog.  If you aren’t familiar with Bing Map Apps, they are mini applications you write in Silverlight that become part of the Silverlight version of Bing Maps.

http://www.bing.com/maps/explore

You have to submit your app for approval.  Approved apps show up in the Map Apps gallery:

image

You bring up the Map Apps gallery by clicking the “MAP APPS” button in the left pane of the Bing Maps UI:

image

Map Apps are a great way to visualize open Government data that has the necessary location information. So far, I haven’t seen many map apps do this other than the Bing Health Maps application:

image

I’m keeping my fingers crossed that some of the apps submitted will use publicly available Government data as the source for Bing Map Apps.  Will you be the person to submit one and win?  I hope so.

Don’t know where to get publicly available Government data? You can find a few over on the producers page of http://odata.org as well as http://data.gov.  Most of the Government OData services on the producers page of http://odata.org use the OGDI starter kit created by my team.  If you are a Government organization that wants to make your data publicly available on the internet through an OData service, then OGDI is a great way to get started.

My Gov2.0 Expo presentation on Bing Maps / OData

You can find my deck here:

http://cid-1f72da7294089597.skydrive.live.com/browse.aspx/Public/Gov2.0Expo

I plan to have my OData + Entity Framework + SQL 2008 spatial demos packaged/cleaned up some time this week.  I will also record a deeper walkthrough of the demo/sample and publish it to Channel 9 some time soon.