Exception in {"Index was outside the bounds of the array."} When use Join three table
mrreddevil2412 opened this issue · comments
Truong Nguyen commented
果糖网 commented
Queryable<T1,T2,T3,T4>
//error
new JoinInfos(joinType,exp)
//ok
(a,b,c,d)=>new JoinInfos(joinType,a.id==b.id,JoinType,b.id==c.id,JoinType ,c.id==d.id)
果糖网 commented
If there are four tables, then a JOIN operation involves three joins
Truong Nguyen commented
I'm join three table and want to return new ApproViewModel
Truong Nguyen commented
I'm fixed :)
I forgot, I had to move the select function after the orderby function.
Thank you for supported!
果糖网 commented
db.Queryable<Order, OrderItem, Custom>((o, i, c) => new JoinQueryInfos(
JoinType.Left, o.Id == i.OrderId,
JoinType.Left, o.CustomId == c.Id
))
.Orderby((o,i,c)=>o.Id)
.Select((o,i,c)=>new ViewModel{ name=o.Name ..})
.ToList()
OR
db.Queryable<Order, OrderItem, Custom>((o, i, c) => new JoinQueryInfos(
JoinType.Left, o.Id == i.OrderId,
JoinType.Left, o.CustomId == c.Id
))
.Select((o,i,c)=>new ViewModel{ name=o.Name ..})
.MergeTable()
.Orderby(it=>it.Name)
.ToList()