0
public class Orgs
{            
     public int Id { get; set; }
     public DateTime OrgCreationTime { get; set; }
     public string AppUserId { get; set; }                 
     public virtual ICollection<OrgPersonRelationshipDomain> ManyOrgPersonRelationship { get; set; }
}

public class OrgPersonRelationshipDomain
{
        //public int ID { get; set; }
        public int OrgId { get; set; }
        public virtual OrgDomain Org { get; set; }
        public bool IsDeleted { get; set; }
}

var orgs = await _context.Org.Where(x => x.Id == request.Id).ToListAsync();

如何过滤“orgs”应该给出结果的列表IsDeleted!= true?我得到的结果只是 ManyOrgPersonRelationship 项目,但我希望其中包含 Orgs 属性。`

4

1 回答 1

1

尝试这个 :

var orgs = _context.Org.Where(x => x.AppUserId == userId && x.ManyOrgPersonRelationship.Any(x => x.IsDeleted != false)).ToList();
于 2020-04-12T05:29:32.850 回答