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