将 union all 和 Subquery SQL 查询转换为 LINQ

Convert union all and Subquery SQL query to LINQ

是否可以帮助我将下面的 SQL 转换为 linq 查询?

SELECT *
FROM BaseCategory
WHERE
    Id = (SELECT ParentId FROM BaseCategory WHERE Id = 10)
UNION ALL
SELECT *
FROM BaseCategory
WHERE
    ParentId = (SELECT ParentId FROM BaseCategory WHERE Id = 10)

给你:

var query = (from c in db.BaseCategory 
            where c.Id = (From c1 in db.BaseCategory 
                          where c1.Id == 10 select c1.ParentId) 
            select c)
            .Concat
            (from c in db.BaseCategory 
            where c.ParentId = (From c1 in db.BaseCategory 
                                where c1.Id == 10 select c1.ParentId) 
            select c)