EF中巢狀類的where查詢

2022-03-02 08:38:28 字數 388 閱讀 5966

有乙個訂單類:order,在訂單order類中有乙個子類,訂單詳細類orderdetail。

需求:根據訂單詳細類的字段過濾資料

public class order

public orderdetail orderdetail

public class orderdetail

public string productname

}}

解決方案:

var query = datacontext.orders

.tolist() //注意這裡,需要把資料tolist()化

.where(o=>o.orderdetail.productname==productname);

java中的巢狀類

幾種內部類的共性 四種不同型別的巢狀類 date 2017年3月16日 author sung lee public class outerofinnerclass 靜態巢狀類 static nested class public static class inner3 public void me...

聯合查詢中where 和and的區別

管理後台,付費酒店如果沒有所屬部門的話,就預設為 4營銷中心 庫里查詢沒有所屬部門的總共有7106多家,select a.vhotelid a.vhotelid b.departmentid from table a left join table info b on a.vhotelid b.vh...

EF提供的3中查詢方式

1.linq to entities using testentities te new testentities lambda方式 using testentities te new testentities 2.query builder mothed using testentities te...