Difference between Early Binding vs Late Binding

Early Binding
// To access Contact entity directly in your code you need to include to include helper class in your solution
Advantage
In Microsoft Dynamics CRM 2015, 2013 & 2011 Software Development Kit contains with a tool (CrmSvcUtil) which can automatically generate helper classes to make it easier to work with your CRM entities and their attributes. You can also generate helper class from MS Visual Studio (greater than 2010 version) if you install CRM SDK Developer tool kit package and connect to CRM organization then generate wrapper class. This provides type checking at compile time, which eliminates the chance of running into InvalidCastExceptionsduring execution of your custom code. It also lets developers take advantage of intellisense by suggesting names for entities, attributes, and relationships. This can speed up development time by removing the risk of spelling mistakes.
Disadvantage
Every time you make a customization change in your system, you will need to run the CrmSvcUtil tool again to ensure that the latest entities, attributes, and relationships are available in your custom applications. The size of the generated file can be large depending on the complexity of your system. Use of the Helper class results in slightly lower performance than the Late-bound entity types.
Late Binding
Advantage
Late binding involves the use of the generic “Entity” class which can manage objects of any entity type. For example, we can use the “Entity” object to programmatically create Accounts, Contacts, Leads, or any custom entity. So in this case we have to define everything explicitly, so here no need to generate helper class again and again. Use of the Entity class results in slightly better performance than the early-bound entity types.
Disadvantage
Type checking is performed at runtime, so developers must explicitly cast attribute values correctly otherwise the custom code will fail during execution. Developers need to be familiar with the late binding syntax as there is no intellisense available.

Comments

Popular posts from this blog

Workflow Activity Input and Output Parameters and Data Types in MS CRM 2013/15/16

Get Workflow Guid in Javascript using OData query

Convert Plugin to Sandbox mode,