Why are the CRM function definitions different for me than the codes I see online?

StackOverflow https://stackoverflow.com/questions/23540843

  •  18-07-2023
  •  | 
  •  

سؤال

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