title: C# Dynamics CRM FilterExpression EntityReference
body: <p>I am trying to build a FilterExpression with a Lookup value. I have tried passing an EntityReference and a Guid. The EntityReference resulted in a runtime error, whereas the Guid resulted in nothing being returned (the EntityCollection is empty, although I know for sure that at least one entity should be returned). What am I doing wrong?</p>
  
  <pre><code>FilterExpression filter = new FilterExpression(LogicalOperator.And);
  filter.AddCondition(new ConditionExpression("referenced_entity", ConditionOperator.Equal, referencedEntityGuid));
  
  retrieveRequest.Query = new QueryExpression
  {
      Criteria = filter,
      EntityName = "my_entity",
      ColumnSet = new ColumnSet(new[] { "referenced_entity", "a_property", "another_property" })
  };
  </code></pre>
  
  <p>I would like to note that <code>referencedEntityGuid</code> is an instance of Guid (obviously) and that when I deactivate the filter, the return type of the <code>referenced_entity</code>-property is <code>EntityReference</code>. Additionally, <code>TotalRecordCount</code> equals -1.</p>