title: How to use Contains with Guid?
body: <p>I am trying to get all enities from a context that are within a collection. While it works this way:</p>
  
  <pre><code>Ticket ticket = context.Tickets.Where(p =&gt; p.TicketId == ticketId);
  ticket.Tasks.Where(p =&gt; !message.Tasks.Select(t =&gt; t.Id).Contains(p.Id));
  </code></pre>
  
  <p>it end in a  exception this way</p>
  
  <pre><code>context.Tasks.Where(p =&gt; message.Tasks.Select(t =&gt; t.Id).Contains(p.Id));
  </code></pre>
  
  <p>Please Note that <code>Id</code> is of Type <code>Guid</code></p>
  
  <p><strong>My Question is how can I write the second query to get all Tasks from the context that are within the message.Tasks collection?</strong></p>
  
  <p>Edit</p>
  
  <p><strong>NotSupportedException</strong></p>
  
  <blockquote>
    <p>Unable to create a constant value of type
    'DataObjects.KeyValueDataObject`2[[System.Guid, mscorlib,
    Version=4.0.0.0, Culture=neutral,
    PublicKeyToken=b77a5c561934e089],[System.String, mscorlib,
    Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089]]'.
    Only primitive types or enumeration types are supported in this
    context.</p>
  </blockquote>
  
  <p>And the class</p>
  
  <pre><code>public class KeyValueDataObject 
  { 
      public TKey Id { get; set; } 
      public TValue Name { get; set; } 
  }
  </code></pre>
  
  <p>Implemented as <code>KeyValueDataObject&lt;Guid,String&gt;</code></p>