WCF Data Services 5.6.0 Alpha


Today we are releasing updated NuGet packages and tooling for WCF Data Services 5.6.0. This is an alpha release and as such we have both features to finish as well as quality to fine-tune before we release the final version.

You will need the updated tooling to use the portable libraries feature mentioned below. The tooling installer is available from the download center.

What is in the release:

Visual Studio 2013 Support

The WCF DS 5.6.0 tooling installer has support for Visual Studio 2013. If you are using the Visual Studio 2013 Preview and would like to consume OData services, you can use this tooling installer to get Add Service Reference support for OData. Should you need to use one of our prior runtimes, you can still do so using the normal NuGet package management commands (you will need to uninstall the installed WCF DS NuGet packages and install the older WCF DS NuGet packages).

Portable Libraries

All of our client-side libraries now have portable library support. This means that you can now use the new JSON format in Windows Phone and Windows Store apps. The core libraries have portable library support for .NET 4.0, Silverlight 5, Windows Phone 8 and Windows Store apps. The WCF DS client has portable library support for .NET 4.5, Silverlight 5, Windows Phone 8 and Windows Store apps. Please note that this version of the client does not have tombstoning, so if you need that feature for Windows Phone apps you will need to continue using the Windows Phone-specific tooling.

URI Parser Integration

The URI parser is now integrated into the WCF Data Services server bits, which means that the URI parser is capable of parsing any URL supported in WCF DS. We are currently still working on parsing functions, with those areas of the code base expected to be finalized by RTW.

Public Provider Improvements

In the 5.5.0 release we started working on making our providers public. In this release we have made it possible to override the behavior of included providers with respect to properties that don’t have native support in OData v3. Specifically, you can now create a public provider that inherits from the Entity Framework provider and override a method to make enum and spatial properties work better with WCF Data Services. We have also done some internal refactoring such that we can ship our internal providers in separate NuGet packages. We hope to be able to ship an EF6 provider soon.

Known Issues

With any alpha, there will be known issues. Here are a few things you might run into:

  • We ran into an issue with a build of Visual Studio that didn’t have the NuGet Package Manager installed. If you’re having problems with Add Service Reference, please verify that you have a version of the NuGet Package Manager and that it is up-to-date.
  • We ran into an issue with build errors referencing resource assemblies on Windows Store apps. A second build will make these errors go away.

We want feedback!

This is a very early alpha (we think the final release will happen around the start of August), but we really need your feedback now, especially in regards to the portable library support. Does it work as expected? Can you target what you want to target? Please leave your comments below or e-mail me at mastaffo@microsoft.com. Thank you!

Comments (21)

  1. Max says:

    As always, this announcements comes without any sort of documentation, so for us (developer) is a little bit hard to find out how to start playing with new features and new capability and because of this provide feedback is difficult too.

    I would really appreciate if forthcoming posts will include some code samples (e.g as Rowan Miller does for EF announcements posts blogs.msdn.com/…/ef-and-visual-studio-2013-preview.aspx)

  2. ErikEJ says:

    How about compression support on Windows Phone?

  3. Kos says:

    Please add the ability to group and (I beg) lazy loading of class fields (such as binary data)

  4. Michael says:

    Are the installers still compatible with Windows XP?   Or is the last version of WCF Data Services that was supported under XP 5.0?   Thanks

  5. Stephen says:

    I don't expect full documentation, but a code example of each feature would improve adoption (if you are serious about wanting feedback).

  6. Stephen says:

    Also, an acknowledgement that your read the comments of your blog posts would also be nice.

  7. v.v. says:

    Please introduce data compression support – not a rocket sience, right?

    Thanks.

  8. @Max/Stephen – thanks for continuing to push on this important point (documentation). We've historically been pretty bad about documentation and it's a muscle we're still trying to grow properly. In this particular release we mostly care about people trying portable libraries, which they should be able to try w/o documentation for the most part – e.g., they can simply try to bring 5.6.0 into a Windows Store project and make it work. Similarly, URI Parser Integration is a feature that doesn't have much attached documentation – if we did our job right, you shouldn't see anything different. We simply componentized something that is really useful for frameworks like WCF DS and Web API so that the component can be reused even if you aren't using WCF DS. Public providers is a different story altogether – I think that feature needs a bunch of documentation, and to be honest we'd like feedback on it, so we should get something together. I'll see what we can sort out for samples by the end of the week. And if you don't hear from me, please feel free to harass me directly via e-mail. 🙂 And Stephen, please consider this acknowledgement that we do read our blog comments even if we don't respond to them as much as we ought to.

    @Erik/v.v. – are you thinking something other than gzip? Depending on what you're targeting, there may be a more-or-less graceful way to do this, but part of the problem here is platform support for gzip. That said, there's a pretty simple way to do gzip with Windows Phone and it's documented here: blogs.msdn.com/…/odata-compression-in-windows-phone-7-5-mango.aspx.

    @Kos – I'm not sure exactly what you're asking – typically there are two boundaries that can be provided – a server side boundary, driven by the EDM model and separate entity types, and a client side boundary, driven by the $select clause. We walk a very fine line trying to balance the overall complexity of OData against the protocol asks we get. Is there a particular reason one of the two existing boundaries won't work for you? This might be a good topic for an e-mail discussion.

    @Michael – while I don't think we test explicitly on Windows XP anymore (I'm sure that you can appreciate that our installation test matrix is enormous already given all the combinations of Windows, Visual Studio and .NET out there), I also don't see any immediate reason why our installers wouldn't work on XP. If you have specific problems I think we would try to look at fixing the problem.

  9. San says:

    Is there any support coming for joining entities?

  10. Hello Mark:

    I've been trying to start a discussion with your team around the providers and other details about the WCF Data Services, but my tries have been ignored. Considering you quoted your disposition to hear us I will try it again.

    I posted on WCF Data Services 5.5.0 and I will repost here my first comments for your team:

    "Tue, May 21 2013 3:51 PM

    Thanks you guys, you are doing amazing work here with WCF Data Services, I really appreciate you make public the built-in providers. I had been making pitfalls loading them through reflection.

    I have been moving towards some scenaries where a different perspective could be nice. For example I’ve been working around to generate a custom WCF Data Service Provider from one Entity Data Model (it is extended with custom annotations to guide layer code generation). I’ve read your source code to follow your logic, but I discovered many logic that I cannot do myself because it requires access to internal members, for example the custom annotations.

    I use the EDM on design mode, that means you must create a EDM, annotate it with custom annotations on EF designer and I generate the source code to cover the application architecture logic, but you really don’t have the EDM on runtime.  It means I cannot use the built-in WCF Data Service EF provider, then I use your Reflection Provider.  Of course I dealt too with missing features like enum support. I don’t understand why, at least, you don't generate enum properties based on numeric enum type (byte, int). Is there any problem with this temporal solution?

    The reflection provider requires one defined type with properties and all steps you know it’s needed. Could the reflection provider do expose members to make fluent and interactive metadata generation? For example: GetResourceType(Type t), GetResourceProperty(PropertyInfo info), it can allow to me use your baseline logic and insert my own information including but not limited to virtual properties and/or associations.

    I guess I cannot emit the virtual types because on these cases the InstanceType will not be the real type.

    Regards.

    PD: If you need I can write more details about my scenary."

    (CONTINUED)

  11. I received a response explaining why the team decided avoid the enum:

    “per enum support, we didn't want to do something temporary because of

    the breaking changes that makes down the road. Enums are part of OData

    v4, which will enable WCF DS to have first class support for them.”

    I got your point and is right, just I would appoint is painful be

    dealing with a feature so basic like enums through tricks. I prefer

    the code refactor and recompilation (so simple on this case) before

    complicate my life “doing myself with tricks”. Of course here I don’t

    have your big picture of all cases, users, requirements, guidelines

    and your decision is understood.

    Providers advanced one step becoming publics, but they are needing

    more appropriated surface to be really ready.

    The current implementation is more like wrappers to the behind

    implementation and because that the inheritance, just redefining the

    behavior but preserving and reusing, the existent logic is limited. I

    was trying to enable the use case where you can to introduce

    properties and behavior to exposed resources, for example working

    around the enum properties, dynamic properties and thinking compose

    services on future. I am coding a T4 template to generate the code for

    custom WCF Data Services from EDM existent on design but not on

    runtime. The excellent solution would be reuse your reflection

    provider or at least allow the programmer can reuse it together with

    the custom generated code, but it’s not easier.

    The built-in providers produce the resources like read-only and I

    cannot extend their metadata conceptions. Just for that I need

    workaround and write code to “steal” the logic:

    /// <summary>

    /// Initializes the metadata based on built-in reflection provider logic.

    /// </summary>

    private void InitializeMetadata()

    {

       if (this._defaultServiceProvider != null) return;

       var reflectionServiceProviderType =

    typeof(DataService<>).Assembly.GetType("System.Data.Services.Providers.ReflectionServiceProvider");

       this._defaultServiceProvider =

    (IDataServiceMetadataProvider)Activator.CreateInstance(reflectionServiceProviderType,

    BindingFlags.NonPublic | BindingFlags.Instance, null, new object[] {

    this, this.CurrentDataSource }, null);

       reflectionServiceProviderType.GetMethod("LoadMetadata",

    BindingFlags.Instance |

    BindingFlags.NonPublic).Invoke(this.DefaultServiceProvider, null);

        //this._defaultServiceProvider = new

    ReflectionDataServiceProvider(new DataServiceProviderArgs(this,

    this.CurrentDataSource, null, true));

        this._typeEntries = new Dictionary<string,

    ResourceTypeEntry>(this._defaultServiceProvider.Types.Count() +

    Math.Max(0, this.DesiredAllTypeEntriesSize));

        this._sets = new Dictionary<string,

    ResourceSet>(this._defaultServiceProvider.ResourceSets.Count() +

    Math.Max(0, this.DesiredAllSetsSize));

    }

    The commented line represents the idea with the public reflection

    provider like the solution.

  12. The custom WCF Data Service provider generated by the template is

    enough to provide CRUD at this point but it doesn’t include the MIME

    types, mapping names, concurrency, streaming and other features the

    built in providers bring. My idea is offer it like a solution when you

    need extend or customize the data service behavior, the idea is not

    substitute the existent implementations.

    In fact it allows inject not generated logic with partial mechanism:

    /// <summary>

    /// Gets the <see cref="T:System.Linq.IQueryable`1"/> that represents

    the container.

    /// </summary>

    /// <param name="resourceSet">The resource set.</param>

    /// <returns>An <see cref="T:System.Linq.IQueryable`1"/> that

    represents the resource set, or a null value if there is no resource

    set for the specified <paramref name="resourceSet"/>.</returns>

    public virtual IQueryable GetQueryRootForResourceSet(ResourceSet resourceSet)

    {

       bool skip = false;

       IQueryable result = null;

       this.BeforeGetQueryRootForResourceSet(resourceSet, ref result, ref skip);

       if(!skip)

       {

          result = this.CoreGetQueryRootForResourceSet(resourceSet);

       }

       this.AfterGetQueryRootForResourceSet(resourceSet, ref result);

       return result;

    }

    /// <summary>

    /// Gets the <see cref="T:System.Linq.IQueryable`1"/> that represents

    the container.

    /// </summary>

    /// <param name="resourceSet">The resource set.</param>

    /// <returns>An <see cref="T:System.Linq.IQueryable`1"/> that

    represents the resource set, or a null value if there is no resource

    set for the specified <paramref name="resourceSet"/>.</returns>

    internal virtual IQueryable CoreGetQueryRootForResourceSet(ResourceSet

    resourceSet)

    {

       return new

    M5lgNavigationPropertiesToSelfComponent((ContextComponent)this.DataServiceProvider.CurrentDataSource,

    "M5lgNavigationPropertiesToSelf").All().AsQueryable();

    }

    /// <summary>

    /// Runs before "GetQueryRootForResourceSet" execution.

    /// </summary>

    /// <param name="resourceSet">The resource set.</param>

    /// <param name="result">References an <see

    cref="T:System.Linq.IQueryable`1"/> that represents the resource set,

    or a null value if there is no resource set for the specified

    <paramref name="resourceSet"/>.</param>

    /// <param name="handled">If this value is returned true means for the

    default logic must be skipped because other external logic took the

    place.</param>

    partial void BeforeGetQueryRootForResourceSet(ResourceSet resourceSet,

    ref IQueryable result, ref bool handled);

    /// <summary>

    /// Runs after "GetQueryRootForResourceSet" execution.

    /// </summary>

    /// <param name="resourceSet">The resource set.</param>

    /// <param name="result">References an <see

    cref="T:System.Linq.IQueryable`1"/> that represents the resource set,

    or a null value if there is no resource set for the specified

    <paramref name="resourceSet"/>.</param>

    partial void AfterGetQueryRootForResourceSet(ResourceSet resourceSet,

    ref IQueryable result);

  13. With BeforeGetQueryRootForResourceSet you can execute logic before the

    core logic be executed and with AfterGetQueryRootForResourceSet you

    can execute logic after the core logic was executed, note like you can

    even request the generated logic be skipped by specifying handle =

    true, it means the BeforeGetQueryRootForResourceSet worked not just

    with the “before” idea, it executed.

    This partial definitions represents entry points to insert logic the

    programmer prefer over the generated by T4 template and again could be

    possible write some logic from scratch or simply write some logic

    based over the built in providers. The rest of custom data service

    provider implementation generated with the T4 could use more the

    default built in providers’ logic too.

    If you consider it appropiated I can continue exchanging use cases,

    troubles and possible solutions from my perspective, we can do it by

    here or by your email.

    Regards

  14. Are you going to support Windows Phone 7.5?

  15. Sandeep says:

    Does the Execute() method depriciated from the  Assembly Microsoft.Data.Services.Client.Portable.dll, v5.6.0.0? I am trying to call the service operation in Windows Store App which seems to have Begin/End Execute but not Execute method.

  16. swetha k says:

    Excellent Post. Also visit http://www.msnetframework.com

  17. John Crim says:

    I appreciate the continued efforts to improve WCF data services.  

    My #1 issue is EF 6.0 support – it's at rc1, so should be out soon.  It is superior to EF 5.x in so many ways, that I'm spending time trying to make web API odata a suitable replacement for WCF data services server.

  18. Chris Robinson (MSFT) says:

    Execute is a sync api that is not allowed on any platform other than the desktop .net Framework. It was removed from the portable library for this reason. You will need to use the async apis instead for a windows phone app. Sync is not supported there either.

  19. Nico says:

    @Mark Stafford – MSFT 8 Jul 2013 8:34 AM

    Do you have any news about documentation or samples, especially about "provider that inherits from

    Entity Framework provider and override a method to make enum and spatial properties work better with WCF Data Services"?

    As far as I understand, complex types (*) are already supported by DS 5.5, enums are waiting for oData V4, but what about spatial types such as DbGeography?

    Is there a solution using classic EF DS Provider in DS 5.6a that supports or at least doesn't crash when exposing such a type?

    In the many different approches I tried (DS 4.0/5.0/5.5/5.6a, oData V2/V3, oData Web API + EF 5.0), the only workaround I found was:

    – forcing DS to use the Reflection DS Provider with an custom "context" class (instead of the EMDX generated DbContext class)

    – ignoring the DbGeography type property using the IgnoreProperties attribute, which is only interpreted by the Reflection DS provider (not EF DS provider, reason of step 1)

    – creating a corresponding spatial type property (GeographyPoint) supported by oData

    – using a wrapper to map these 2 types, as explained here:

    http://www.odata.org/…/how-to-use-sql-spatial-data-with-wcf-odata-spatial

    This solution works (DS 5.5 and 5.6a) for some simple queries, and even returns spatial information!

    $top and $filter options are correctly handled (SQL Server Profiler).

    Projections ($select) however crash: "Unable to create a null constant value of type 'System.Data.Services.Internal.ProjectedWrapper3'.

    Only entity types, enumeration types or primitive types are supported in this context."

    Spatial queries as well, e.g. $filter=geo.distance(DSLocation, geography'Point(-122.03547668457 47.6316604614258)') lt 4:

    "LINQ to Entities does not recognize the method 'System.Nullable`1[System.Double] Distance(System.Spatial.Geography, System.Spatial.Geography)' method,

    and this method cannot be translated into a store expression."

  20. Nico says:

    I'd love to provide some more feedback about DS 5.6a, but I'm kind of stuck as I didn't experienced any differences yet between versions 5.5 and 5.6a,

    and the above workaround (using Reflection provider) isn't really acceptable regarding my requirements,

    i.e. oData queries using:

    – ideally Data Services 5.5/5.6 or, if no choice, oData Web API, but currently Web API is even not supporting projection ($select)

    – with Entity Framework 5/6

    supporting:

    – projection ($select, $expand)

    – filtering ($filter)

    – sorting ($orderby)

    – paging ($top, $skip)

    – count ($inlinecount)

    of

    – simple property

    – navigation property

    – spatial types

    – complex types (*) (not mandatory)

    – enums (not mandatory)

    So if you could provide some samples, I'd be happy to give you further assessments.

    * by the way, isn't it disappointing not being able to make projection ($select) of complex types?

    DS 5.5:  $expand=ComplexProperty&$select=ComplexProperty/Property => "$select doesn't support projecting properties of complex type."

    DS 5.6a: $expand=ComplexProperty&$select=ComplexProperty/Property => "Inner or start path segments must be navigation properties in $select."