please find method which calls to get people entries with casting to derived class object
var people = database.GetDatabase("Test") .GetCollection<Person>("People").AsQueryable();
var x = people.Where(z => z.Addresses.OfType<Email>().Any(e => e.MailTo == "not@home.com"));
throws an exception:
"The method OfType is not supported in the expression tree:
.OfType()."
class Person
{
public List<Address> Addresses
}
class Address
{
}
class Phone : Address
{
public string Number { get; set; }
}
class Email : Address
{
public string MailTo
}