Developing an OData consumer for the Windows Phone 7


A couple of days back at Mix we announced the CTP release of the OData Client Library for Windows Phone 7 series.

Cool stuff undoubtedly.

But how do you use it?

Well Phani, a Data Services team member, shows you how on his blog.

Comments (5)

  1. Any word on when the next drop of the OData client for WP7 will be? I've found a few blocking issues that don't exist in the Silverlight 4 OData libraries that is preventing us from using the WP7 version. Thanks.

  2. Shalan007 says:

    Same here. The LoadAsync is crashing all the time I give a more complex linq query to it.

    Very bad so that I can't do any selection of data – only returning the complete feed is working,

    query.Expression=

    Expression:[10000].Where(o => (o.Mahlzeit = value(MyDietLogWP7.ModelHandler+<>c__DisplayClass0).mahlzeit))

    A first chance exception of type 'System.MethodAccessException' occurred in mscorlib.dll

    A first chance exception of type 'System.MethodAccessException' occurred in System.Data.Services.Client.dll

    Error:System.MethodAccessException: MethodAccessException

      at System.Reflection.RuntimeConstructorInfo.InternalInvoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture, StackCrawlMark& stackMark)

      at System.Activator.InternalCreateInstance(Type type, BindingFlags invokeAttr, Binder binder, Object[] args, CultureInfo culture, StackCrawlMark& stackMark)

      at System.Activator.CreateInstance(Type type, Object[] args)

      at IQToolkit.ExpressionEvaluator.EvaluatorBuilder.Constant(ConstantExpression c)

      at IQToolkit.ExpressionEvaluator.EvaluatorBuilder.Build(Expression exp)

      at IQToolkit.ExpressionEvaluator.EvaluatorBuilder.MemberAccess(MemberExpression m

  3. Shalan007, that is exactly the issue I found as well. It pretty much makes OData unusable on WP7 right now. Note, hardcoding your filter works .Where(item => item.name == "hardcodedstring")

    Of course how often does your data NOT reside in a variable!?

  4. I found a workaround in case anyone cares: use CreateQuery and AddQueryOption instead. You end up with a bunch of ugly strings as opposed to nice clean, strongly-typed LINQ, but it works! Hopefully the OData team will release an update soon.

  5. 7heaven11 says:

    Hey I'm trying to connect SQL Azure on the Windows Phone 7 platform. I'm using DataServiceQuery to access my database on the cloud, but I cant find a way to update/add/delete my database using the same. Please help me out with sample codes! Thanks a lot.