Shawn

Shawn Wildermuth

Stories

Tagged with Data Services


Using OData with Windows Phone 7 SDK Beta

Url: http://wilderminds.blob.core.windows.net/downloads/wp7odatamovies.zip

Windows Phone 7

While I was giving my OData talk, someone asked about consuming OData on the WP7 phone. I had done this on the CTP earlier, but hadn't tried it during the beta. So I figured I'd look into it today. While this is still pretty easy to do, the tooling still isn't in place. This means that you can't simply do an "Add Service Reference" to a Windows Phone 7 project. Instead you have to follow these steps:

Read...


How We Used Data in GiveAQuiz.com

Url: http://msdn.microsoft.com/en-us/library/ff84745...

Silverlight Logo

As many of you may have heard, I recently launched http://GiveAQuiz.com as a new web site for creating and taking quizzes. The Data Team at Microsoft were great in helping me build this site. I've written a whitepaper detailing how we used the Microsoft data stack to accomplish it. This whitepaper shows how we used these data technologies to build the site:

Read...


SQL Azure's OData Support

OData

I've ported my XBoxGames Database (see this blog article for copies of the .mdf files) to SQL Azure and added OData support. You can find the feed here:

https://odata.sqlazurelabs.com/OData.svc/v0.1/w9hratewlg/XBoxGames

Read...


WCF Data Services and jQuery

Url: http://wilderminds.blob.core.windows.net/downloads/dataservicejque...

ODataI'd recently been asked by Chris Sells to help him with a simple WCF Data Services/jQuery example so I thought I'd share it via my blog as well. The basic idea is to use jQuery's AJAX functionality to retrieve JSON instead of the usual OData and consume it on a web page.

The example I decided on using is to expose the XBox database with paging. I am not doing any of the niceties like getting result counts to show a real navigation bar.  Instead this is quick and dirty to simply do "next" and "prev" and use WCF Data Service's URI API to retrieve data.

Read...


The State of Data Access in Silverlight

SilverlightI've said much about my opinion of Silverlight data access. Currently this is Web Services, WCF Data Services and WCF RIA Services. Let's talk about Data Services and RIA Services and how they are related:

WCF Data Services

Data Services are a good story in Silverlight, but only as of version 2.0 of the protocol. For those users of version 1.0, using Data Services was painful as automatic tracking did not exist yet. Data Services can create not only the data contract classes, but a context object that will do tracking and batching for you.  The basic story of how Data Services works is that it takes a context object from a LINQ provider and exposes all the IQueryable endpoints as REST resources that can be queried. This works well in creating a place to execute queries and post/put/delete changes. While Data Services' URI API is another skill that could be learned, the Silverlight (and .NET) client library allows you to just issue LINQ queries to the data service.  In addition, the ability to create client-designed graphs (e.g. embed relationships for eager loading) and navigate relationships to the server presents a good API for a data-centric application today.

Read...


ADO.NET Data Services 1.5 Feature: Projections

SilverlightIf you've been following my blog, you should know that I am keeping a pretty close watch on ADO.NET Data Services. The team recently released a second CTP of the new version with some interesting features. This CTP has some pretty compelling additions, but I am going ot focus on one in particular.

I've been teaching and using ADO.NET Data Services for a long time and I like showing off exposing a LINQ-based provider (Entity Framework, NHibernate or others) to a Silverlight application. While ADO.NET Data Services does expose its API through a REST API, the magic for me is in its use in Silverlight. In case you haven't been following along, using the Silverlight client you can issue a LINQ query through the Silverlight client (though in fairness, the full power of LINQ is not supported in the client):

var qry = (from g in ctx.Games
           where g.Genre.Name == "Shooter"
           orderby g.ReleaseDate
           select g) as DataServiceQuery<Game>;

qry.BeginExecute(new AsyncCallback(r =>
{
  try
  {
    theList.ItemsSource = qry.EndExecute(r).ToList();
  }
  catch (Exception ex)
  {
    // NOOP
  }
}), null);

This is a powerful feature so that (unlike web services) developers can use a looser service definition to define their data stack. Let the developer who needs data be able to sort, filter and shape that data as necessary.

Read...


"Which Data Access Should I Use for Silverlight 3?"

Silverlight Logo

It all depends...

 

Read...


DevTeach Silverlight+MVVM=Easy Demo

Url: http://wilderminds.blob.core.windows.net/downloads/DevTeachGameSto...

Silverlight Logo

Fun first day here at DevTeach. I a talk showing creating a MVVM application from scratch (using ADO.NET Data Services 1.5 CTP). Kathleen Dollard had introduced the concept earlier that day, but we teach it a lot differently so it was fun to show off building a full MVVM application in the span of 75 minutes. 

Read...


Not at the PDC? Come Watch Me Talk about ADO.NET Data Services

Url: http://notatpdc.com/presentations/

Today at 3pm CST (4pm EST, 1pm PST) I will be doing a LiveMeeting talk on ADO.NET Data Services. If you are not at the PDC this week, drop by NotAtPDC.com and check out my session!

Read...


ADO.NET Data Services and TimeZone

There is a known problem with ADO.NET Data Services today that is important if you (or your server) lives in specific timezones.  The problem is associated with the way that the Silverlight Data Services Library constructs their URI for searches. 

The problem surfaces if you do a query that has a DateTime comparison in it. For example:

var qry = from o in ctx.Orders
          where o.OrderDate <= dt
          select o;

This query generates the following URI in the EST timezone in the US:

Read...


Silverlight and ADO.NET Data Service Operations

In building my Silverlight RC example using ADO.NET Data Services for Entity Framework and NHibernate I ran into what I think is a common pattern.  I am writing an editor for XBox game data. The model for this data uses decorator tables in the database which are modeled as a common "Product" class and derived "Game", "Console" and "Accessory" classes.  In the application I am using paging to only look at fifty results at once. This works fine on both sides. 

But one of the pieces of information I wanted was a list of all the Game Genre.  This became problematic as ADO.NET Data Services wanted me to retrieve all 880 games in order to get a list of these Genres (of which there are only 20 some odd). The whole idea of using paging is go avoid the huge overhead of bringing down the whole entity. Interestingly when I executed a LINQ query that used projection into non-entities, the query wasn't supported as projection isn't allowed in the ADO.NET Data Services URI model (which the client uses).

What ADO.NET Data Services does allow is to create Service Operations (e.g. WebGet or WebInvoke) on the Data Service to extend the model for specific cases. There are some limitations (must return IEnumerable<T>, IQueryable<T> or void) but this works pretty well. The difference between returning IEnumerable and IQueryable is whether system queries can be applied to them.  Returning a fixed list (my need) meant to return a IEnumerable<T> list. Intersting that ADO.NET Data Services support returning an IEnumerable<T> of primitive types.  For example my operation was spec'd as:

Read...


ADO.NET Data Services Performance Issues

Url: http://www.silverlightdata.com

It has come to my attention that my current examples using ADO.NET Data Services are performing very badly. I was using that example as anecdotal evidence that Data Services performed slower than the Web Service counterparts.  I don't think this is accurate.  I am working on some performance comparisons that I will share on my blog once Silverlight 2 goes into a full release so I can be sure that the numbers reflect a real-world release.

The issue seems to surround a bone-headed query I was making:

Read...


My Silverlight 2 Data Services Article Code Updated

Url: http://wilderminds.blob.core.windows.net/downloads/sl2_ds_example.zip

I've uploaded a new version of my code from my Silverlight 2/Data Services MSDN Article. I took the new Silverlight 2 Data Services client that was released and updated the code example. If you want to get the code, you can download it from my site here:

http://wilderminds.blob.core.windows.net/downloads/sl2_ds_example.zip

Read...


New Build of Silverlight Library for Data Services!

Url: http://blogs.msdn.com/astoriateam/archive/2008/...

Mike Flasko to the rescue! The ADO.NET Data Services Team has released an interim build of the ADO.NET Data Services Library to address .NET 3.5 SP1 incompatibilities.  While this is just a stop-gap measure, its of great relief that I announce this news as my new MSDN Magazine article was broken because of the incompatibility.

Follow the link for all the information, warnings and download links.  As Mike says, this is an interim build to address the incompatibility but that you shouldn't rely on it for production machines.  The real build will come with Silverlight 2's release whenever that actually happens.

Read...


Caveats About My Silverlight 2 Data Services Article

Url: http://msdn.microsoft.com/en-us/magazine/cc7942...

As some of you may have seen, my new article in MSDN Magazine (and online) was recently published. Because we're in a bit of a no-mans-land with builds, the current article only works with .NET 3.5 SP1 Beta and Silverlight 2 Beta 2. This means if you're like most of the world and updated to the full release of .NET 3.5 SP1, some of the code in that article is not going to work for you. I hope to have a new drop of the code (and maybe the article too) once Silverlight 2 ships and is fully compatible with ADO.NET Data Services/Entity Framework that are in the full version of .NET 3.5 SP1.  See my other article talking about the incompatibilities here:

My apologies to anyone who spent too much time trying to get the code in the article working. Such is the problem with beta software and hopefully we'll have a solution sooner rather than later.

Read...


My ADO.NET Data Services/Silverlight 2 Article on MSDN Magazine

Url: http://msdn.microsoft.com/en-us/magazine/cc7942...

My new article on creating Silverlight 2 applications that use ADO.NET Data Services is in the new issue of MSDN Magazine. In this article I show you how to create a ADO.NET Data Service as well as how to call that service using the Silverlight 2 Data Service Library. 

What is cool about this approach is that you can issue LINQ queries on the client (in Silverlight 2) that will communicate with Data Services via the REST interface and execute queries and update data on the server.  The substantial difference that you will have to get used to is the use of Asynchronous LINQ queries in Silverlight 2.  Check out the article for all the details.

Read...


VS 2008 SP1 RTM + Silverlight 2 Beta 2 == No ADO.NET Data Services

Url: http://timheuer.com/blog/archive/2008/08/11/vis...

UPDATE: This may be incorrect.  I am working with Microsoft to understand if I got this wrong.  I'll update this blog once I get the story right.

As everyone has announced already, Visual Studio 2008 and .NET 3.5 have released an SP1 that includes a bunch of fixes as well as the Entity Framework as well as ADO.NET Data Services. To support this, the Silverlight team dropped a new version of the Visual Studio tools that work with Silverlight 2 Beta 2 and Visual Studio 2008 SP1.

Read...


Implementing IUpdatable (Part 3)

UPDATE: I know the title is wrong and it should be IUpdateable but I didn't want to break any links for any RSS feeds that already had it.

If you haven't read Part 1 or Part 2 first, you should start there.

In this final part of the IUpdateable implementation, we will discuss the rest of the methods which includes ClearChanges, ResolveResource, ReplaceResource, SetReference, AddReferenceToCollectionRemoveReferenceFromCollection and SaveChanges.

Read...


Debugging ADO.NET Data Services...with Fiddler2

Url: http://www.fiddler2.com/fiddler2/

When I deployed the small test application (http://www.silverlightdata.com/simple), it was pretty apparent that it was performing really badly. Some of this is because my ISP upload speed isn't great but it was still taking far too long I thought.  This was a simple app with not much data, so I knew I wanted to find out what was happening. If you haven't seen the site, its basically an editor for the Product table in the Northwind database.  Nothing special really.

ADO.NET Data Services does a lot of work for you under the covers.  This is good because we're not being asked to write a lot of serialization and transportation code, but it can be bad because it becomes more difficult to see why things are happening. Fiddler2 to the rescue!

Read...


Using ADO.NET Data Services in Silverlight 2 Beta 2

Url: http://msdn.microsoft.com/en-us/data/bb931106.aspx

UPDATE: I had the PUT/POST reversed.  It reads correctly now.  (Thanks to commenter Rob for pointing it out).

Now that Silverlight 2 Beta 2 has launched, we have the ability to consume ADO.NET Data Services (formerly Astoria) from within Silverlight projects. ADO.NET Data Services are a perfect match for client-side technologies like Silverlight and ASP.NET AJAX.

Read...


Upgrading Entity Framework and ADO.NET Data Services to SP1

I've known Julie Lerman (or is it Julia these days ;) for a long time now.  She's an excellent resource for everything data related.  In particular she's been keeping up with the Entity Framework and ADO.NET Data Services (formerly Astoria) updates in .NET 3.5 and VS SP1 Beta that was just released this week.  If you are upgrading projects (like I am), she has two excellent blog posts about how to upgrade your projects:

New Entity Framework Changes

New ADO.NET Data Services (Astoria) Changes

Read...


Come Hear Me at the Alabama Code Camp this Saturday

Url: http://www.alabamacodecamp.com

I will be at the Alabama Code Camp this weekend to talk about Silverlight, the Entity Framework and Astoria.  The talks I am doing are:

Feel free to stop by and harrass me with questions or disagreements.  I'll be there all day.

Read...


Hear Me Discuss Astoria on Hanselminutes

Url: http://hanselminutes.com/default.aspx?showID=115

I got to spend some time with Scott Hanselman on his Podcast (Hanselminutes) discussing Astoria and how it *not* just exposing your database to the Internet.We delved into REST and how Astoria and Silverlight are a good mix for the right application. 

Check it out when you have a chance.

Read...


Astoria Silverlight Extensions Released!

Url: http://www.microsoft.com/downloads/details.aspx...

ADO.NET Data Services Silverlight Extensions now released.  This library is used in Silverlight 2.0 projects to access Astoria without all the headaches of serialization.  Check it out!

I will be updating my http://silverlightdata.com site soon with a new build including these bits.

Read...


ADO.NET Data Services (e.g. Astoria) Docs Hiding in Plain Sight

Url: http://astoria.mslivelabs.com/Using%20ADO.NET%2...

Read...