What's New in WCF Data Services 5.0
The following new OData version 3.0 functionality is supported by WCF Data Services in this release:
All and Any Operators
OData now enables you to filter feeds based on the contents of a collection. By using the new all and any operators, you can filter an OData feed based on properties of a related collection or multi-value property.The .NET Framework client library now supports use of the All<TSource>(IEnumerable<TSource>, Func<TSource, Boolean>) and Any<TSource>(IEnumerable<TSource>) set operators in a language integrated query (LINQ) query. For more information, see LINQ Considerations (WCF Data Services).
Collection Properties *
OData now enables you to define collection properties on types in the data model of your data service. These collection properties contain unordered collections of primitive or complex types.Named Resource Streams
OData now enables you to define named resource streams for a given entity. This gives you the ability to have more than one binary data stream associated with a given entity. For more information, see Streaming Provider (WCF Data Services).The .NET Framework client library now enables you to access named resource streams. For more information, see Working with Binary Data (WCF Data Services).
New Data Types
OData defines the following new data types, which are supported by WCF Data Services:Geospatial Types*
OData now supports geospatial data types as a new set of primitives. For more information, see Spatial Library.
DateTimeOffset
TimeSpan
PATCH Requests
A new PATCH method has been added to the HTTP standard. OData now supports this new HTTP method. WCF Data Services handles PATCH requests in the same way that it handles MERGE requests.The .NET Framework client library now enables you to request that updates be sent to the data service by using a PATCH request. For more information, see Managing the Data Service Context (WCF Data Services).
Prefer Header Support
OData now supports the ability for clients to request whether or not a payload is returned in response to a POST, PUT, MERGE, or PATCH request. This client preference is indicated in the request by the value of the Prefer header. When using the .NET Framework client, this preference is managed by the DataServiceContext. For more information, see Managing the Data Service Context (WCF Data Services).Service Actions
OData enables you to define a service action, which is a specialized kind of service operation. Service actions provide a way to inject behaviors into an otherwise data-centric model. Service actions enable you to invoke business logic in OData, where the logic must be bound to a give resource. For more information, see Using OData Actions to implement server-side behavior.Vocabulary Annotations
OData supports the ability to extent data service metadata by defining vocabularies. WCF Data Services enables you to apply vocabularies to the data model by using annotations. For more information, see the post Vocabularies in WCF Data Services.
* New OData feature not currently supported by the Entity Framework provider.
The following additional functionality is provided by WCF Data Services in this release:
Entity Framework Provider Support for DbContext
WCF Data Services now enables you to use a class that inherits from DbContext as an Entity Framework provider data source, as you would with a class that inherits from ObjectContext. DbContext is a new Code First class introduced in Entity Framework 4.1 that replaces ObjectContext. Previously, a work-around was required to be able to use a DbContext object as a data source.Including Relationship Links in the Response
The OData protocol defines a method for addressing relationships between entities by using the $links operator in a URI. WCF Data Services now enables you to request that the data service include these links in entry elements in the response. This behavior is controlled by the IncludeRelationshipLinksInResponse configuration property. For more information, see Configuring the Data Service (WCF Data Services).The .NET Framework client library now uses relationship links when constructing URIs that address related entities, when they are present in the response.
Navigation Properties on Derived Types
In this release, WCF Data Services supports the ability to define a navigation property on a derived type. In previous releases, navigation properties could only be defined on the base type.Support for Entity Sets with Different Base URIs
The OData protocol allows for a data service to expose entity sets as collections that have different base URIs. Previously, the .NET Framework client assumed that all entity sets shared the same base URI defined in the DataServiceContext. Now, you can define a delegate that is used by the context to resolve URIs for entity sets that do not share a base URI. For more information, see Managing the Data Service Context (WCF Data Services).
See Also
Concepts
Data Service Versioning (WCF Data Services)