Skip to main content

Taming the Beast: Early vs. Late Binding in Microsoft Dynamics 365

 Hey there, code wranglers! Are you ready to dive deep into the fascinating world of Microsoft Dynamics 365? Today, we're going to explore the differences between Early Binding and Late Binding, two popular programming techniques that you can use to make the most out of this powerful platform. We'll compare examples, performance metrics, and development times, and we'll even sprinkle in some references for those of you hungry for more information. So let's saddle up and get started!

Early Binding - A Swift Ride:

Early Binding is like a well-trained horse that knows exactly where it's going. With Early Binding, you'll be working with strongly-typed classes generated from the CRM metadata. This means you'll have access to IntelliSense, making it easy to spot errors during development and reducing the time it takes to write code.

Let's take a look at an example of Early Binding in action:

 using Microsoft.Xrm.Sdk;  
 using Microsoft.Xrm.Sdk.Client;  
 using Microsoft.Crm.Sdk.Messages;  
 using System.ServiceModel;  
 // Connect to the Organization Service  
 IOrganizationService service = GetOrgService();  
 // Create a new account  
 Account newAccount = new Account  
   Name = "Contoso Ltd.",  
   Address1_City = "Seattle",  
   Address1_StateOrProvince = "WA"  
 Guid accountId = service.Create(newAccount);  

In this example, we've created an Account entity using the strongly-typed Account class. Not only does this code look clean and easy to read, but it also allows for better error-checking during development.

Late Binding - A Wild Adventure:

Late Binding, on the other hand, is like riding a wild stallion: it offers more freedom, but it's also a bit more challenging to handle. Late Binding uses the Entity class, allowing you to create and manipulate records in a more dynamic way. Here's an example of Late Binding:

 using Microsoft.Xrm.Sdk;  
 using Microsoft.Xrm.Sdk.Client;  
 using Microsoft.Crm.Sdk.Messages;  
 using System.ServiceModel;  
 // Connect to the Organization Service  
 IOrganizationService service = GetOrgService();  
 // Create a new account  
 Entity newAccount = new Entity("account");  
 newAccount["name"] = "Contoso Ltd.";  
 newAccount["address1_city"] = "Seattle";  
 newAccount["address1_stateorprovince"] = "WA";  
 Guid accountId = service.Create(newAccount);  

In this case, we've used the generic Entity class and specified the entity type with a string. While this approach is more flexible, it lacks the benefits of IntelliSense, making it more error-prone and increasing development time.

Performance Metrics and Development Time:

Early Binding tends to have better performance due to its strongly-typed nature. However, the difference in performance between the two approaches is often negligible, particularly for smaller-scale projects. When it comes to development time, Early Binding is generally faster, thanks to IntelliSense and better error-checking.


Whether you choose Early Binding or Late Binding, Microsoft Dynamics 365 has the power and flexibility to help you create amazing applications. Just remember, like any good wrangler, you need to choose the right technique for the job. Don't be afraid to mix and match both approaches based on your project's specific needs and your own coding style.

Recommendations on when to use each:

  1. Early Binding:
    • When you need better compile-time error checking and type safety.
    • If you prefer working with IntelliSense for a more streamlined development experience.
    • When your project requires a more structured and organized coding style.
    • If your team is already familiar with the Dynamics 365 SDK and its generated types.
  2. Late Binding:
    • When you need more flexibility and adaptability in your code.
    • If you're working with a dynamic system where the schema or entity types may change frequently.
    • When your project is smaller in scale and doesn't require the full advantages of Early Binding.
    • If you're building a generic or reusable solution that needs to work with multiple Dynamics 365 environments or versions.

Now that you know the differences between Early and Late Binding and have some recommendations on when to use each, you're ready to ride off into the sunset and create some fantastic solutions for your organization. Remember, practice makes perfect, so don't shy away from experimenting with both techniques to see which one works best for you. The more you learn and adapt, the better your coding skills will become. So grab your hat, your coding boots, and your trusty steed, and embark on your own coding adventure with Microsoft Dynamics 365!

Happy coding, partner!


  1. Seattle's reputation as a tech hub is bolstered by its vibrant community of software developers. In this article, we'll uncover Seattle Software Developers the dynamics Seattle Software Developers of the software development scene, exploring the opportunities, challenges, and the essence of being a part of this thriving ecosystem.

  2. The presence of industry giants like Microsoft and Amazon provides unparalleled opportunities for software developers. On the other hand, Seattle Software Developers startups bring innovation and agility to the scene, creating a dynamic environment for both budding and seasoned developers.


Post a Comment

Popular posts from this blog

Validating User Input In CRM Portals With JavaScript

When we are setting up CRM Portals to allow customers to update their information, open cases, fill out an applications, etc. We want to make sure that we are validating their input before it is committed to CRM.  This way we ensure that our data is clean and meaningful to us and the customer. CRM Portals already has a lot validation checks built into it. But, on occasion we need to add our own.  To do this we will use JavaScript to run the validation and also to output a message to the user to tell them there is an issue they need to fix. Before we can do any JavaScript, we need to check and see if we are using JavaScript on an Entity Form or Web Page.  This is because the JavaScript, while similar, will be different.  First, we will go over the JavaScript for Entity Forms.  Then, we will go over the JavaScript for Web Pages.  Finally, we will look at the notification JavaScript. Entity Form: if (window.jQuery) { (function ($) { if (typeof (entityFormClientVali

Dynamics Set IFrame URL - D365 v8 vs. D365 v9

While doing client work, I came across a problem with setting an IFrame URL dynamically.  The underlying issue was that the sandbox instance is on v8 of Dynamics 365 and production is on v9 of Dynamics 365.  The reason for this was because this client was setup around the time that Microsoft rolled out v9.  Anyways, JavaScript that I wrote to dynamically set the URL of the IFrame wasn't working in the v9 instance.  This was because of changes that Microsoft made to how IFrames are loaded on the form and also changes to JavaScript. Here is my v8 setup: JavaScript runs OnLoad of contact form.  This works because of how IFrames are loaded in v8.  You can also run it on either a tab change (hide / show) or OnReadyStateComplete event of the IFrame.  Depending on your setup you will need to choose which is best for you.  For me in this case it was the OnLoad event. Here is the JavaScript: function OnLoad() { //Get memberid var value =

Navigating Microsoft Dynamics 365 Customization: Plugins vs. Azure Functions

Embarking on the Microsoft Dynamics 365 customization journey offers numerous opportunities to enhance your business processes. However, deciding between the available options, such as Plugins and Azure Functions, can be challenging. This engaging post will serve as your trusty guide, helping you choose the best option for your Dynamics 365 customization needs! The Two Customization Pathfinders: Plugin and Azure Function The Agile Plugin 🏃‍♂️ Reference: Microsoft Docs - Write a plug-in Plugins are like the swift trail runners of the Dynamics 365 customization world. They're the go-to choice for quick, real-time (synchronous), or background (asynchronous) operations that occur within the platform. They can intercept events and modify data before it's saved or displayed to the user. Choose Plugins when: You need real-time processing (synchronous) or background processing (asynchronous). You want to ensure data integrity. You need tight integration with Dynamics 365. Plugins mig