Servicestack ORMLite Query Multiple -
i wondering if ormlite had querymultiple solution dapper.
my use case in getting paged results.
return new { posts = conn.select<post>(q => q.where(p => p.tag == "chris").limit(20, 10)) totalposts = conn.count<post>(q.where(p => p.tag == "chris")) };
i have few other cases i'm calculating other stats in addition main query, , i'm keen avoid multiple roundtrips.
(probably unrelated, i'm using postgresql)
you can this:
var boththings = db.exec(cmd => { cmd.commandtext = @" select * tablea select * tableb"; var both = new bothaandb(); using (var reader = cmd.executereader()) { both.a = reader.converttolist<a>(); reader.nextresult(); both.b = reader.converttolist<b>(); } return both; });
it might possible wrap in extension method, nothing clever coming mind.
Comments
Post a Comment