How can we improve WCF Data Services?

WCF Data Services Client - support convention of Id properties (not just ID)

WCF Data Services Clients only detect key properties that end with "ID" - ending with "Id" doesn't work, as it does in EntityFramework.

To be clear, I had to jump through some hoops to make my portable model library work with the WCF Data Services Client (like many people, I want to use the same model classes on the server and client). I found that a class like this:

public class Person
{
public int Id { get; set; }
public string LastName { get; set; }
}

(using DbContext class on the server:)
public class PeopleDb : DbContext
{
public DbSet<Person> People { get; set; }
}

This will work fine with EF 5.2 (and 6.0), and will work on the WCF Data Services server. However, it won't work on the WCF Data Services client, as the class is detected as a complex type, not an entity, because it's missing an "ID" field. This is the case even if I explicitly load the Entity Data Model from the $metadata URL. I poked through the decompiled WCF Data Services Client code, and found that the code effectively includes .EndsWith("ID"). It should be modified to .EndsWith("Id", StringComparison.OrdinalIgnoreCase) . This way it will support conventions that are consistent with the other Microsoft data developer projects.

12 votes
Vote
Sign in
(thinking…)
Sign in with: facebook google
Signed in as (Sign out)
You have left! (?) (thinking…)
John Crim shared this idea  ·   ·  Flag idea as inappropriate…  ·  Admin →

0 comments

Sign in
(thinking…)
Sign in with: facebook google
Signed in as (Sign out)
Submitting...

Feedback and Knowledge Base