我正在尝试排除a.id
存在于db.AdminAdjusterStatus
.
from u in db.Users
join a in db.Adjusters on u.id equals a.userID
where u.userType.ToLower() == "adjuster"
&& !(from x in db.AdminAdjusterStatus select x.adjusterID).Contains(a.id)
select new AdjusterProfileStatusItem { user = u, adjuster = a }
上面的代码说,“其中 NOT 包含a.id
在db.AdminAdjusterStatus.adjusterID
.
问题是,它不起作用。我有这两个条目db.AdminAdjusterStatus
:
A9EC05B5-651D-4AA7-8275-1F6BFE212C03 1BDE55D9-ED0A-4854-9D5F-B89DB17F02D2
而且,LINQ 查询给了我:
A9EC05B5-651D-4AA7-8275-1F6BFE212C03 1BDE55D9-ED0A-4854-9D5F-B89DB17F02D2 e21ff49c-9505-495d-b4a3-c259ee3459d6
然而,它应该只给我:
e21ff49c-9505-495d-b4a3-c259ee3459d6