Using WCF Data Services 4.0, I cannot get the hierarchical data to return. I have a class Employee that has a collection of EquipmentIds. Those EquipmentIds are getting lost over the wire. Here’s my code:
public class ODataV2 : DataService<ODataV2Model>
{
public static void InitializeService(DataServiceConfiguration config)
{
config.UseVerboseErrors = true;
config.SetEntitySetAccessRule("*", EntitySetRights.AllRead);
config.DataServiceBehavior.MaxProtocolVersion = DataServiceProtocolVersion.V2;
}
}
public class ODataV2Model
{
public ODataV2Model()
{
Employees = new List<Employee>{
new Employee { Id = 1, Name="Doug", EquipmentIds = new List<Equipment> { new Equipment { Id = 1 },new Equipment { Id = 2 } }.AsQueryable()},
new Employee { Id = 2, Name= "George", EquipmentIds = new List<Equipment> {new Equipment { Id = 3}, new Equipment { Id = 5} }.AsQueryable() }
}.AsQueryable();
}
public IQueryable<Employee> Employees { get; private set; }
public IQueryable<Equipment> EquipmentIds { get; private set; }
}
[DataServiceKey("Id")]
public class Employee
{
public int Id { get; set; }
public string Name { get; set; }
public IQueryable<Equipment> EquipmentIds { get; set; }
}
[DataServiceKey("Id")]
public class Equipment
{
public int Id { get; set; }
}
When I run LinqPad on it, I get this:

I should have both collections of EquipmentIds with counts of 2, but I have 0. I don’t receive an error, but the data never makes it to the client.
I switched to WCF Data Services v 5.0 and it works successfully on the .NET side, but I lose the ability to query with LinqPad. Is there a way for this to work in v 4.0?
If not, is there a way to upgrade LinqPad to recognize odata v3 (WCF Data Services 5.0)?
The query ~/Employees will only include the Employee entities and not any navigation property content. This is to reduce the payload size. If you really want to include some of the navigation properties just specify for example ~/Employees?$expand=EquipmentIds.