Wah*_*eed 3 c# entity entity-framework
我想在实体框架工作中有以下类型的查询
SELECT c2.*
FROM Category c1 INNER JOIN Category c2
ON c1.CategoryID = c2.ParentCategoryID
WHERE c1.ParentCategoryID is NULL
Run Code Online (Sandbox Code Playgroud)
如何在Entity框架中完成上述工作......
好吧,我对EF知之甚少,但看起来像是:
var query = from c1 in db.Category
where c1.ParentCategoryId == null
join c2 in db.Category on c1.CategoryId equals c2.ParentCategoryId
select c2;
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
7201 次 |
| 最近记录: |