db4o: LINQ equivalent of SODA query? -
for db4o, i'm trying find linq code generates following soda:
var query = db4o.db.query(); query.descend("symbol"); query.descend("_symbolglobal").constrain("apple"); query.descend("_date"); // add date constraint here. iobjectset result = query.execute();
all soda drop down tree end node. example, if wanted select "apple" date "2010-10-18", return "apples on thursday".
data structure:
root ----symbol (apple) | |------day 1: date: 2010-10-18, string "apples on thursday" | |------day 2: date: 2010-10-19, string "apples on friday" | | |-----symbol (pear) |------day 1: date: 2010-10-18, string "pears on thursday" |------day 2: date: 2010-10-19, string "pears on friday"
here first attempt, doesn't work getting cross product (i.e. looking @ every possible combination). can't use join, db4o object database , don't have access id each object, in rdbms.
var stringfordayandsymbol = s in db4o.db.query<symbol>(a => a.symbolglobal == "apple") t in db4o.db.query<date>(b => b.date == new datetime(2010, 10, 20)) select new { s.symbolglobal, t.date, t.meta };
do directly want descent "symbol" query.descend("symbol");
? guess want constrain type 'symbol'. assume meant this:
var query = db4o.db.query(); query.constrain(typeof(symbol)); query.descend("_symbolglobal").constrain("apple"); query.descend("_date"); // add date constraint here. iobjectset result = query.execute();
not 100% sure, should this:
// assume here field _symbolglobal accessable property symbolglobal // , field _date accessable property date var result = symbol s in db4o.db s.symbolglobal == "apple" select s.date;
Comments
Post a Comment