我正在使用Entity Framework 4.0,并且遇到以下查询问题:IQueryable<user> users = from u in Entities.users. Include("orders_assigned").Include("orders_assigned.order_line_items") from o in u.orders_assigned where o.status.Equals((int)OrderStatus.ReadyForInvestigation) && o.assigned_to_user_id != 0 from oli in o.order_line_items where oli.line_item_type.Equals("service") || oli.line_item_type.Equals("package_service") select u;我试图返回包含其订单子列表的用户列表,其中包含订单行项目的子列表(类似于user-> orders-> order_line_items),如上面的includes所示-但是,只要我调用此查询,它仅显示返回用户列表。我以前用ToTraceString都没问题,不确定这次我在做什么错。 (adsbygoogle = window.adsbygoogle || []).push({}); 最佳答案 尝试:IQueryable<user> users = ((ObjectQuery<user>) from u in Entities.users from o in u.orders_assigned where o.status.Equals((int)OrderStatus.ReadyForInvestigation) && o.assigned_to_user_id != 0 from oli in o.order_line_items where oli.line_item_type.Equals("service") || oli.line_item_type.Equals("package_service") select u).Include("orders_assigned").Include("orders_assigned.order_line_items");Explanation here. (adsbygoogle = window.adsbygoogle || []).push({});
07-26 03:18