I apologize for my vague question title

I found a code online that suggests a way to create a queryexpression as follows:

 QueryExpression query = new QueryExpression(entity1Name)
    {
        ColumnSet = new ColumnSet(false)
    };

When I tried to do the same in my code, I got an error that the : no constructor exists for QueryExpression that takes 1 argument. However, I can create my queryexpression using this way:

       QueryExpression query = new QueryExpression();
        query.EntityName=entity1Name;
        ColumnSet cset = new ColumnSet();
        cset.AllColumns = false;

This is just an example of many other CRM objects that also behave differently on my side.

有帮助吗?

解决方案

QueryExpression class is defined inside the namespace Microsoft.Xrm.Sdk.Query (from Microsoft.Xrm.Sdk.dll) and it has 2 constructors:

public QueryExpression();
public QueryExpression(string entityName);

if you got an error probably you are not referencing the dll included inside the CRM 2011 SDK

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top