title: Invalid CRM 2011 LINQ Query: "Invalid 'where' condition. An entity member is invoking an invalid property or method."
body: <p>I am trying to execute this query to retrieve Audit items for specific entity types </p>
  
  <pre><code>public List&lt;Audit&gt; GetAuditChangesSince(DateTime since, string entityType)
  {
      return (from a in OrgContext.CreateQuery&lt;Audit&gt;()
          where
              a.ObjectId != null &amp;&amp; a.ObjectId.LogicalName == entityType &amp;&amp;
              a.CreatedOn &gt; since
          select a).ToList();
  }
  </code></pre>
  
  <p>The <strong>a.ObjectId != null &amp;&amp; a.ObjectId.LogicalName == entityType &amp;&amp;</strong> clause is causing problems. I know .Equals() may cause problems (hence ==) and there are these limitations to the LINQ Provider:</p>
  
  <p><em>The left side of the clause must be an attribute name and the right side of the clause must be a value</em></p>
  
  <p>The left side is a property and the right side is a constant. Is the .ObjectId.LogicalName causing the problem? </p>