How to query for entities with no matching siblings, with LINQ?

Posted by Ryan on Stack Overflow See other posts from Stack Overflow or by Ryan
Published on 2014-06-10T15:11:29Z Indexed on 2014/06/10 15:24 UTC
Read the original article Hit count: 152

Filed under:
|
|

I've got the two following entities ...

class Citation
{
  public int CitationId { get; set; }
  public string Identifier { get; set; }
}

class CitationIdentifier
{
  public int CitationIdentifierId { get; set; }
  public string Identifier { get; set; }
}

I'm trying to query for all Citation records where the Identifier property does not match any of the CitationIdentifiers record Identifier property. So, if I have a Citation with an Identifier property containing "foo", but there are no CitationIdentifier records with an Identifier property containing "foo", then I'd like to retrieve that Citation.

I'm working with an IDbSet<Citation>.

Any ideas? Thanks.

© Stack Overflow or respective owner

Related posts about c#

Related posts about LINQ