How to: Customize Feeds with the Reflection Provider (WCF Data Services)

 

WCF Data Services enables you to customize the Atom serialization in a data service response so that properties of an entity may be mapped to unused elements that are defined in the AtomPub protocol. This topic shows how to define mapping attributes for the entity types in a data model that is defined by using the reflection provider. For more information, see Feed Customization.

The data model for this example is defined in the topic How to: Create a Data Service Using the Reflection Provider

In the following example, both properties of the Order type are mapped to existing Atom elements. The Product property of the Item type is mapped to a custom feed attribute in a separate namespace.

[!CODE [Astoria Custom Feeds#CustomIQueryableFeeds](../CodeSnippet/VS_Snippets_Misc/astoria custom feeds#customiqueryablefeeds)]

The previous example returns the following result for the URI http://myservice/OrderItems.svc/Orders(0)?$expand=Items.

[!CODE [Astoria Custom Feeds#IQueryableFeedResultInline](../CodeSnippet/VS_Snippets_Misc/astoria custom feeds#iqueryablefeedresultinline)]

Reflection Provider

Show: