System.Object does not have property 'xxx' GeneratePropertyAccessQueryForOpenType

Topics: ASP.NET Web API
Jan 25, 2013 at 3:56 PM

I am creating a simple oData method in my web api application. When I attempt to call ODataQueryOptions.Apply to I get the following exception;

System.Object does not have property 'xxx' GeneratePropertyAccessQueryForOpenType

My query string is fairly simple

http://localhost:25491/data/Catalog/All?$filter=bar eq 'ab'

The implementation of my controller method is;

public class Foo       

{           

	public string bar { get; set; }       

}

[HttpGet]

public IQueryable<Foo> Get(ODataQueryOptions ops, string channel, string id)       

{

            var output = new Foo[]           

		{               

			new Foo { bar = "ab" } ,               

			new Foo { bar = "cd" }           

		};           

		var cb = output.AsQueryable<Foo>();           

		var result = ops.ApplyTo(cb);           

		return result as IQueryable<Foo>;       

}

The following query string works as expected it is just a problem with the $filter

http://localhost:25491/data/Catalog/All?$orderby=bar

 

Thanks in advance

Jan 26, 2013 at 2:36 AM

I tried this out and cannot repro it. Is it possible for you to share a standalone repro ?