1

I'm using WCF web api to bui;d a rest service that returns coplex objects from an odata query. Unfortunately, querying complex types doesn't seem to work. E.G.

 public IQueryable<Person> Get()
    {
        var people = new List<Person>()
        {
            new Person {
                Name="John", 
                Department = new Department{Id=2, Description="Lion Swaddling"}
            },
            new Person {
                Name="Jane", 
                Department = new Department{Id=4, Description="Face Surgery"}
            },
        };

        return people.AsQueryable();
    }

The following uri returns nothing. http://localhost/api/people?$filter=Department/Id%20eq%20'2'

Does the Web Api, in fact, support querying complex types? And if so, is there something special i must to to enable it?

jwanga
  • 4,166
  • 4
  • 26
  • 27

1 Answers1

1

Resolved: Turns out some of my objects had null Description values. Once i made sure all had values it worked fine.

jwanga
  • 4,166
  • 4
  • 26
  • 27