3
没有关于此类的示例或文档。如果我错了,我真的会为任何链接感到高兴!如何使用servicestack ormlite JoinSqlBuilder
我不明白我应该通过什么作为下一个参数,以及如何使整个事情作为查询在SqlConnection上执行。
有人可以帮助我吗?
var sql = new JoinSqlBuilder<Schoolyear, Period>()
.Join<Schoolyear, Period>(s => s.Id, p => p.SchoolyearId);
.Where(p => p.MyDate > DateTime.Now) // This Where clause does not work
// How to execute the sql?
// How to attach the query to an SqlConnection?
UPDATE
OK 2小时后:
using (IDbConnection con = dbFactory.OpenDbConnection())
{
var sql = new JoinSqlBuilder<Schoolyear, Period>().Join<Schoolyear, Period>(s => s.Id, p => p.SchoolyearId,
destinationWhere: p => p.LessonDate >= startDateOfWeek && p.LessonDate < endDateOfWeek).ToSql();
return con.Query(sql); /* There is not Query on the idbconnection although ormlite is using the con.Query in its samples? or return dbConn.Exec(dbCmd => dbCmd.Select<T>()); There is no .Select extension method? */
}
好的我现在选择,但我找不到有关此方案的示例:使用订单检索客户。 customer.cs具有列表属性。这可能吗? –
HelloWorld
我假设你的意思是这样的问题:http://stackoverflow.com/questions/20563669/populating-pocos-with-servicestack-ormlite/20568007#20568007 – hross
是的谢谢。我会在第4版中尝试一下。并观看你所说的多个疑问...... – HelloWorld