Jaa


Time to get the WCF Data Services 5.6.0 RTM Tools

Folks who have recently tried to download and install the OData Client Tools for Windows Store apps (the one that I have been using in all my apps, samples, and blog posts to date) have been blocked by a certificate issue that prevents the installation of this client and tools .msi. While a temporary workaround (hack, really) is to simply set the system clock back by a few weeks to trick the installer, this probably means that it’s time to start using the latest version of WCF Data Services tooling.

Besides actually installing, the WCF Data Services 5.6.0 Tools provide the following benefits:

  • Support for Visual Studio 2013 and Windows Store apps in Windows 8.1.
  • Portable libraries, which enables you to code both Windows Store and Windows Phone apps
  • New JSON format

You can find a very detailed description of the goodness in this version at the WCF Data Services team blog.

Get it from: https://www.microsoft.com/en-us/download/details.aspx?id=39373 

Why you need the tools and not just the NuGet Packages

Besides the 5.6.0 tools, you can also use NuGet.org to search for, download, and install the latest versions of WCF Data Services (client and server). This will get you the latest runtime libraries, but not the Visual Studio tooling integration. Even if you plan to move to a subsequent version of WCF Data Services via NuGet, make sure to first install these tools—with them you get these key components to the Visual Studio development experience:

  • Add Service Reference

Without the tools, the Add Service Reference tool in Visual Studio will use the older .NET Framework version of the client tools, which means that you get the older assemblies and not the latest NuGet packages with all the goodness mentioned above.

  • WCF Data Services Item Template

Again, you will get the older assemblies when you create a new WCF Data Service by using the VS templates. With this tools update, you will get the latest NuGet packages instead.

Once you get the 5.6.0 tools installed on your dev machine, you can go back to using the goodness of NuGet to support WCF Data Services in your apps.

My one issue with the new OData portable client library

The coolness of a portable client library for OData is that both Windows Store and Windows Phone apps use the same set of client APIs, which live in a single namespace—making it easier to write common code that will run on either platform. However, for folks who have gotten used to the goodness of using DataServiceState to serialize and deserialize DataServiceContext and DataServiceCollection<T> objects, there’s some not great news. The DataServiceState object didn’t make it into the portable version of the OData client. Because I’m not volunteering to write a custom serializer to replace DataServiceState (I heard it was a rather tricky job), I’ll probably have to stick with the Windows Phone-specific library for the time being. I created a request to add DataServiceState to the portable client (I think that being able to cache relatively stable data between executions is a benefit, even on a Win8 device) on the feature suggestions site (please vote if you agree): Add state serialization support via DataServiceState to the new portable client.

WCF Data Services and Entity Framework 6.0

The Entity Framework folks have apparently made some significant changes to things in Entity Framework 6.0, so significant in fact that it breaks WCF Data Services. Your options to work around this are:

For details about all of this, see Using WCF Data Services 5.6.0 with Entity Framework 6+.

I actually came across this EF6 issue when I was trying to re-add a bunch of NuGet packages to a WCF Data Services project. When you search for NuGet packages to add to your project, the Manage NuGet Packages wizard will only install the latest versions (pre-release or stabile) of a given package. I found that to install an older version of a package, I had to use the Package Manager Console instead. One tip is to watch out for the Package Source setting in the console, as this may be filtering out the version you are looking for.

Cheers,

Glenn Gailey

Comments

  • Anonymous
    February 01, 2014
    Glen, This Tools installer (and the 5.3.0 version as well) seems to break Lightswitch in VS2012. After installing, when you point Lightswitch to any OData source, it creates proxies similar to the output of 'Add Service Reference'. Everything will compile, but at runtime, there is a constraint violation that is thrown. I have posted details on the Lightswitch forum (social.msdn.microsoft.com/.../0a07aca5-2aa0-4366-8bc7-06c63c93d4a2) but no one has shown any interest. In short, there is a class -  Microsoft.LightSwitch.ServerGenerated.Implementation.AstoriaDataServiceImplementation which expects the auto-generated DataServiceContext to be passed in, but at runtime, it sees the actual passed-in version as a type constraint violation - even though the namespaces are equivalent. Using clean installation of VS 2012, I've verified that everything works as expected until this Tools installer is run. And after uninstalling it, Lightswitch reverts to behaving as expected. However, the tools update is needed for other code to work as advertised. For example: the container.Format.UseJson() functionality in a Data Services Client (non-Lightswtich) only works without runtime errors if the service proxies are generated under this toolset. Any suggestions?

  • Anonymous
    February 03, 2014
    Mike, I'll ask around and see if anyone knows about this.