Monday, 31 December 2012

Microsoft Dynamics CRM 2011 and Microsoft Dynamics CRM Online - Programming Using Early and Late Binding

In Microsoft Dynamics CRM 2011, you can choose from several programming scenarios to find the model that best suits your needs. The programming scenario in Microsoft Dynamics CRM 4.0 used the Web Services Description Language (WSDL) with early bound classes for each entity, and the DynamicEntity class for late-bound programming. You were also required to use late-bound programming for plug-in and custom workflow development. All of this has changed with the new programming models.

The main development scenario for Microsoft Dynamics CRM 2011 no longer uses the WSDL. Instead, you now reference two assemblies that allow you to connect to any Microsoft Dynamics CRM system for both early and late bound types. This scenario can be described as late binding or loosely typed. To use late bound types, use the Entity class. This class defines a collection of attributes that can be used to get and set the values of attributes. To use this model, the exact logical name must be known (and specified) as a string.

Alternatively, you can use early bound classes generated directly from the metadata, which include all customizations. The generated classes provide early binding and IntelliSense to aid you as you write custom code.

The DynamicEntity class has been replaced by the base class Entity. This means that all types are discoverable at both build time and runtime, making all strongly-typed entities now loosely-typed entities. You can use both programming scenarios in the same code as shown in the following example:


Account entity = new Account();
entity["name"] = "My Account"; //loosely typed, late binding
entity.AccountNumber = "1234"; //strongly typed, early binding

The Microsoft Dynamics CRM SDK documentation includes samples that use both programming scenarios. The early bound samples use a file of strongly-typed classes that are generated with the code generation utility from a new, uncustomized installation of Microsoft Dynamics CRM. To run the samples, you must generate a file of strongly-typed classes from your installation. You can decide whether to create a proxy assembly from the generated code file or to include the file in your project directly.

My above blog is based on Microsoft's Official information.
I hope this blog about 'Microsoft Dynamics CRM 2011 and Microsoft Dynamics CRM Online - Programming Using Early and Late Binding' was informative. Please feel free to leave your comments.


  1. In Microsoft Dynamics CRM, there are many programming scenarios. But now, there are programming assemblies for early and late binding.