【发布时间】:2015-03-13 23:52:14
【问题描述】:
没有关于这个类的示例或文档。如果我错了,我真的会对任何链接感到高兴!
我不明白我应该传递什么作为下一个参数以及如何使整个事情作为 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?
更新
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? */
}
【问题讨论】: