Considerations for Code Upgrade

Dynamics CRM 2011
[Applies to: Microsoft Dynamics CRM 2011]

In Microsoft Dynamics CRM 2011, feature changes and improvements may require you to change your code. This topic covers many areas where code changes are needed.

In This Topic

Use the New Authentication Scheme

The authentication process has changed in Microsoft Dynamics CRM 2011. The new version supports claims-based authentication and Active Directory authentication. For more information, see Authenticate Users with Microsoft Dynamics CRM Web Services and Use Microsoft Dynamics CRM Services in Code.

Use the New Types

In Microsoft Dynamics CRM 2011, the programming model has been changed to use native .NET types whenever possible. For example, the type CrmBoolean used in Microsoft Dynamics CRM 4.0 is now of type bool or System.Boolean. For more information, see Types in the Microsoft Dynamics CRM SDK.

Use the New Entity Class

In Microsoft Dynamics CRM 2011, you can use the Entity class to work with entities instead of the DynamicEntity class that used in Microsoft Dynamics CRM 4.0. This lets you use late binding so that you can work with types such as custom entities and custom attributes that were not available when your application was compiled. When initialized, the Entity class contains the logical name of an entity and a property-bag array of the entity’s attributes. For more information about the Entity class, see Use the Late Bound Entity Class in Code.

Use WCF Data Services Instead of ASMX Files

Windows Communication Foundation (WCF) is used for establishing a communication channel to the Microsoft Dynamics CRM Web services. The Microsoft Dynamics CRM SDK simplifies the use of these technologies by providing helper proxy classes that make it easy to connect to the Web services over the WCF communication channels. For more information, see Use the Sample and Helper Code.

Use the Consolidated and Expanded Query Methods

There are now three different types of queries you can use, depending on the best choice for your scenario. The RetrieveMultiple method, RetrieveMultipleRequest and any message that uses the QueryBase class can now take a QueryExpression or a FetchExpression. In addition, there is a new type of query that uses you can use .NET Language-Integrated Query (LINQ) to write queries. The OrganizationServiceContext class contains an underlying .NET Language-Integrated Query (LINQ) query provider that translates LINQ queries from Microsoft Visual C# or Microsoft Visual Basic .NET syntax into the query API used by Microsoft Dynamics CRM. For more information, see Build Queries with LINQ (.NET Language-Integrated Query).

The ExecuteFetchRequest message is deprecated with this release so you should use the RetrieveMultiple method or RetrieveMultipleRequest message when executing FetchXML queries. For more information, see Build Queries with FetchXML.

Use New Error Handling

The way that errors are returned from the server has changed in Microsoft Dynamics CRM 2011. You should use the catch blocks described in the topic Handle Exceptions in Your Code.

In addition, the error codes returned for some errors have changed. If your code includes logic based on the specific error code returned, you need to update your code to reflect these changes. The following table lists error codes that were changed in Microsoft Dynamics CRM 2011.


Microsoft Dynamics CRM 4.0 Microsoft Dynamics CRM 2011 Error string



Cannot create/update attribute with attribute required level ReadOnly.



Unexpected AttributeTypeCode value Internal.



Attribute Display Name description is null or empty.



The import file is invalid. XSD validation failed with the following error: '{0}'. The validation failed at: '...{1} <<<<<ERROR LOCATION>>>>> {2}...'."



The import file is invalid. XSD validation failed with the following error: '{0}'. The validation failed at: '...{1} <<<<<ERROR LOCATION>>>>> {2}...'."




The {0}({1}) component cannot be deleted because it is referenced by {2} other components. For a list of referenced components, use the RetrieveDependenciesForDeleteRequest.



The evaluation of the current component(name={0}, id={1}) in the current operation ({2}) failed during managed property evaluation of condition: {3}

See Also

Microsoft Dynamics CRM 2011
Send comments about this topic to Microsoft.
© 2013 Microsoft Corporation. All rights reserved.