Watch keynotes and sessions from, our virtual developer conference.

AsQueryable for a class that has ExpandoObject

Hi All!

I have a class that looks like this:

public class Record

	public string AppName
		get { return this.appName; }
		set { this.appName = value; }

	public ExpandoObject Contents { get; set; }


Now, all I want to do is to access the items inside Contents such as dateOfBirth to do something like this:

var collection =
.Where(x => (DateTime)x.Contents.First(z => z.Key == “dateOfBirth”).Value > DateTime.Now ).ToList();

But I am getting this exception:

System.NotSupportedException: ‘The expression tree is not supported: {document}{contents}’

Am I doing something wrong? Is there a way to run filters on ExpandoObjects using LINQ at all?