I have a class Post
which is an Entity Framework model. It contains a property like this:
public bool Showable {
get {
return this.Public && this.PublishedDate > DateTime.now
}
}
I can use it in a query like this:
from p in db.Posts where p.Showable select p;
but when I have a property that uses it, like this
public IEnumerable<Post> ShowablePosts {
get {
return from p in db.Posts where p.Showable select p;
}
}
then I can't do:
from p in ShowablePosts where p.Id > 42 select p;
It says:
The specified type member 'Showable' is not supported in LINQ to Entities. Only initializers, entity members, and entity navigation properties are supported.