title: Linq Expression with multiple nested properties
body: <p>I have read through the question, and answer, <a href="https://stackoverflow.com/questions/40363333/dynamic-linq-expression-tree-with-nested-properties">Dynamic linq expression tree with nested properties</a>. It does seem to be very similar, though a lack of understanding with Expressions is resulting in me not being able to translate the answer to my own scenario.</p>
  
  <p>Given a class structure that looks a little like this:</p>
  
  <pre><code>public class Parent
  {
      public Parent()
      {
          ParentField = new HashSet&lt;ParentField&gt;();
      }
      public int ParentId { get; set; }
      public ICollection&lt;ParentField&gt; ParentField { get; set; }
  }
  
  public class ParentField
  {
      public int ParentField { get; set; }
      public Field Field { get; set; }
      public string Value {get;set;}
  }
  
  public class Field
  {
      public int FieldId { get; set; }
      public string Name { get; set; }
  }
  </code></pre>
  
  <p>I am trying to build up a query that would be represented by this:</p>
  
  <pre><code>var query = _unitOfWork.ParentRepository.Queryable().Include("ParentField.Field");
  query = query.Where(i =&gt;
      (
          i.ParentField.Any(pField =&gt; pField.Field.Name.Equals("anId", StringComparison.OrdinalIgnoreCase)) &amp;&amp;
                  i.ParentField.Any(pField =&gt; 
                  // There may be multiple values to search for, so require the OR between each value
                  pField.Value.Equals("10", StringComparison.OrdinalIgnoreCase) || pField.Value.Equals("20", StringComparison.OrdinalIgnoreCase))
      )
      // There may be multiple Names to search for, so require the AND between each Any
      &amp;&amp;
      (
          i.ParentField.Any(pField =&gt; pField.Field.Name.Equals("anotherId", StringComparison.OrdinalIgnoreCase)) &amp;&amp;
                  i.ParentField.Any(pField =&gt; 
                  pField.Value.Equals("50", StringComparison.OrdinalIgnoreCase) || pField.Value.Equals("60", StringComparison.OrdinalIgnoreCase))
      ));
  </code></pre>
  
  <p>The important parts to note is that there can be many "Field.Name"'s to search for, as well as multiple "Values" within each of the groups. </p>
  
  <p>I'm not able to give much of an example of what I have tried so far, given I am not sure where to actually start.</p>
  
  <p>Any pointers would be fantastic.</p>