I'm pretty sure the answer to this is "you can't do that" or "No, no, you misunderstand...", but:
I have a linq class, thing, which will happily execute this:
var thingsWithAandB = from t in db.things
where t.propA.HasValue && t.propB.HasValue
select t;
But I do this a lot, and so I want:
partial class thing
{
public bool hasAandB
{
get
{
return propA.HasValue && propB.HasValue;
}
}
}
and then:
var thingsWithAandB = from t in db.things where t.hasAandB select t;
But of course, when I do this, I get "Can't translate that into SQL" errors. And I understand that this is because calling methods in the middle of SQL queries isn't possible, since my code and the database are separate.
What's the way to do this? Is it impossible?