Early binding and Late binding

Early Binding:
To use early binding, you must generate the entity classes by using the code
generation tool called CrmSvcUtil.exe, a console application that you can find in the SDK\bin folder
CrmSvcUtil.exe /url:http://crmwoifd/demo/XRMServices/2011…
After installing it we get GeneratedCode.cs through which we can write Early binding code.
Early binding which provides IntelliSense support and better code development after using of .NET technologies. For example we r writing code for account when we will write account. it will give all the field name and so on.

Compiler binds the objects to methods at the compile time.All the type checking will be done at compile time only. This is called early binding or static binding. Function overloading is example for early binding.

Late Binding:
Compiler binds the objects to methods at the runtime. All the type checking will be done at runtime rather than Compile time.This is called late binding or dynamic binding. Function overriding is example for late binding.

When using late binding, accessing and using the Organization Service is difficult and you need to explicitly type both the entity and attribute’s names.
This can lead to make mistakes while writing the code and get an error.

Performance issue:
The Late-binding has a good performance as compared to early binding bcoz late-binding process starts fast and remain constant throuhout the process but in the case of early binding the process starts slow and keep increasing its process speed but it never crosses the process speed of late binding as I read in Microsoft MSDN.

note : /out:GeneratedCode.cs /username:bill /password:p@ssword!

In early biniding we r able to download a proxy classes which is something like a service classes, when we r consuming the web sservices at that tym we r able to download WSDL files and proxy files which will automatically create the classes by the help of those classes we r able to write some coding that is early binding.
In Early binding which provides IntelliSense support and better code development after using of .NET technologies such as the .NET Framework Language-Integrated Query (LinQ). suppose we r writing code for account when we will write account. it will give all the field name and so on.

The key difference between early and late binding involves type conversion. While early binding provides compile-time checking of all types so that no implicit casts occur, late binding checks types only when the object is created or an action is performed on the type.
The Entity class requires types to be explicitly specified to prevent implicit casts.

we r defining the structure when we r executing the codes that tym it will validate for all the datatypes means all the checking will be done at runtime but in the case of early all the type checking and all it will done when we r building the application

 

 

 

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s