I know what is possible with linq2db4o
from Apple a in db
where a.Color.Equals(Colors.Green)
select a
What I need, but this is what allows me to build my query conditionally (as I can in other linq variants)
public IEnumerable<Apple> SearchApples (AppleSearchbag bag){
var q = db.Apples;
if(bag.Color != null){
q = q.Where(a=>a.Color.Equals(bag.Color));
}
return q.AsEnumerable();
}
In a real situation, a lot of properties will be stored in a search package, and creating a giant if-tree that catches all possible combinations of filled properties will be crazy work.
You can call first
var q = (from Color c in db select c);
and then continue from there. but that’s not quite what I am looking for.
Disclaimer: almost a duplicate of my question almost 11 months ago.
This is a little clearer, as I now understand, and now I hope that some of the db4o dev eyes will understand this on this:
Any suggestions?