WCF Data Services Friendly Feeds and Issues with EntityPropertyMapping (EPM)
I was trying to get friendly feeds working for the baseball stats OData feed (WCF data Services). I use Orcsweb’s current .NET 4 beta accounts to host the project. I am trying to have Friendly Feeds for the OData feed so they can be easier to display data from all browsers. This involves feed customization like Phani blogged about here:
I tried customizing a few EntityTypes in the EDMX and tested locally to get the correct Titles for each entity produced in the feed. Below is an example for having the TeamFranchise.franchName be the Title for each entity in the AtomPub result set:
<EntityType Name="TeamFranchise">
<Key>
<PropertyRef Name="franchID" />
</Key>
<Property Name="franchID" Type="String" Nullable="false" MaxLength="3" Unicode="true" FixedLength="false" />
<Property Name="franchName" Type="String" MaxLength="50" Unicode="true" FixedLength="false"
m2:FC_TargetPath="SyndicationTitle"
m2:FC_EpmContentKind="Plaintext"
m2:FC_EpmKeepInContent="true" />
<Property Name="active" Type="String" MaxLength="2" Unicode="true" FixedLength="false" />
<Property Name="NAassoc" Type="String" MaxLength="3" Unicode="true" FixedLength="false" />
<NavigationProperty Name="Teams" Relationship="BaseballStatsModel.FK_Teams_TeamsFranchises" FromRole="TeamFranchise" ToRole="Team" />
</EntityType>
<EntityType Name="TeamHalf">
<Key>
<PropertyRef Name="yearID" />
<PropertyRef Name="lgID" />
<PropertyRef Name="teamID" />
<PropertyRef Name="Half" />
</Key>
<Property Name="yearID" Type="Int16" Nullable="false" />
<Property Name="lgID" Type="String" Nullable="false" MaxLength="2" Unicode="true" FixedLength="false" />
<Property Name="teamID" Type="String" Nullable="false" MaxLength="3" Unicode="true" FixedLength="false" />
<Property Name="Half" Type="String" Nullable="false" MaxLength="1" Unicode="true" FixedLength="false" />
<Property Name="divID" Type="String" MaxLength="1" Unicode="true" FixedLength="false" />
<Property Name="DivWin" Type="String" MaxLength="1" Unicode="true" FixedLength="false" />
<Property Name="Rank" Type="Int16" />
<Property Name="G" Type="Int16" />
<Property Name="W" Type="Int16" />
<Property Name="L" Type="Int16" />
<NavigationProperty Name="Team" Relationship="BaseballStatsModel.FK_TeamsHalf_Teams" FromRole="TeamHalf" ToRole="Team" />
</EntityType>
I deployed to the Orcsweb’s webservers that are hosting with .NET 4.0 RC and attempted to get results from the following call:
http://173.46.159.199/baseballstats/BaseballStats.svc/TeamFranchises
I received the following error:
The server encountered an error processing the request. The exception message is ‘Attempt by method ‘System.Linq.Expressions.Expression.CreateLambda(System.Type, System.Linq.Expressions.Expression, System.String, Boolean, System.Collections.ObjectModel.ReadOnlyCollection`1<System.Linq.Expressions.ParameterExpression>)’ to access method ‘System.Linq.Expressions.Expression`1<System.Func`3<System.Object,System.Data.Services.Providers.DataServiceProviderWrapper,System.String>>.Create(System.Linq.Expressions.Expression, System.String, Boolean, System.Collections.ObjectModel.ReadOnlyCollection`1<System.Linq.Expressions.ParameterExpression>)’ failed.’. See server logs for more details. The exception stack trace is:
Checking with the Data Services team this is a known issue involving EntityPropertyMapping (EPM). The issue involves having the Service in a partial trust environment like many web hosting providers have with shared hosting accounts. The only way this Feed Customization can work is when the Service has full trust. There is no workaround at this time. They seem to be working on a solution but they could not get it into this release.
So this will cause some discomfort if people developing OData need to make changes to the EPM.
The feed at http://173.46.159.199/baseballstats/BaseballStats.svc/ has been reverted back with no Feed Customization in order for people to continue to test with the feed.








Chris,
We just released a patch that fixes this issue.
Please read this blog post : http://blogs.msdn.com/astoriateam/archive/2010/05/08/ado-net-data-services-update-for-net-framework-3-5-sp1-refresh.aspx
Phani
Odata Feed customization…
MSDN article about feed customization:…