<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: umargulzar1122</title>
    <description>The latest articles on DEV Community by umargulzar1122 (@umargulzar1122).</description>
    <link>https://dev.to/umargulzar1122</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F795422%2F20676136-62f6-4086-9295-f8b185f71475.png</url>
      <title>DEV Community: umargulzar1122</title>
      <link>https://dev.to/umargulzar1122</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/umargulzar1122"/>
    <language>en</language>
    <item>
      <title>Early Bound Plugins</title>
      <dc:creator>umargulzar1122</dc:creator>
      <pubDate>Mon, 17 Feb 2025 11:10:30 +0000</pubDate>
      <link>https://dev.to/umargulzar1122/early-bound-plugins-29mh</link>
      <guid>https://dev.to/umargulzar1122/early-bound-plugins-29mh</guid>
      <description>&lt;p&gt;Early Bound Classes in C# for Dynamics 365 are strongly typed representations of entities in Dataverse (formerly CDS). These classes are generated using the build command  / CrmSvcUtil tool and provide compile-time checking, IntelliSense support, and better performance when interacting with Dynamics 365 data.&lt;/p&gt;

&lt;p&gt;This repository guides generating early-bound classes for use with the Microsoft Dataverse SDK for .NET. Early-bound classes enhance development by offering:&lt;/p&gt;

&lt;h2&gt;
  
  
  Improved Code Readability and Maintainability:
&lt;/h2&gt;

&lt;p&gt;Strongly typed classes represent Dataverse entities, making code more intuitive.&lt;/p&gt;

&lt;h2&gt;
  
  
  Compile-Time Type Checking:
&lt;/h2&gt;

&lt;p&gt;Reduces runtime errors by ensuring type safety during development.&lt;br&gt;
  Enhanced Developer Productivity: Utilize IntelliSense to discover tables, columns, and choice options.&lt;/p&gt;
&lt;h2&gt;
  
  
  LINQ Query Support:
&lt;/h2&gt;

&lt;p&gt;Leverage the OrganizationServiceContext class to write LINQ queries against Dataverse data.&lt;/p&gt;
&lt;h1&gt;
  
  
  Prerequisites
&lt;/h1&gt;

&lt;p&gt;Before generating early-bound classes, ensure you have the following:&lt;/p&gt;
&lt;h3&gt;
  
  
  .Net Framework Class Library
&lt;/h3&gt;

&lt;p&gt;Add the .Net Framework Class library to your solution.&lt;/p&gt;
&lt;h3&gt;
  
  
  Power Platform CLI:
&lt;/h3&gt;

&lt;p&gt;&lt;a href="https://learn.microsoft.com/en-us/power-platform/developer/cli/introduction?tabs=windows#install-microsoft-power-platform-cli" rel="noopener noreferrer"&gt;Install the latest version.&lt;/a&gt;  &lt;/p&gt;
&lt;h3&gt;
  
  
  Dataverse Plug-ins:
&lt;/h3&gt;

&lt;p&gt;&lt;a href="https://www.nuget.org/packages/microsoft.crmsdk.coreassemblies/" rel="noopener noreferrer"&gt;Microsoft.CrmSdk.CoreAssemblies&lt;/a&gt;&lt;/p&gt;
&lt;h3&gt;
  
  
  Client Applications
&lt;/h3&gt;

&lt;p&gt;&lt;a href="https://www.nuget.org/packages/Microsoft.PowerPlatform.Dataverse.Client/" rel="noopener noreferrer"&gt;Microsoft.PowerPlatform.Dataverse.Client&lt;/a&gt;&lt;/p&gt;
&lt;h1&gt;
  
  
  Setup Instructions
&lt;/h1&gt;

&lt;p&gt;1). Install Power Platform CLI: Follow the official installation guide.&lt;/p&gt;

&lt;p&gt;2). Authenticate: Connect to your Dataverse environment using:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;  pac auth create &lt;span class="nt"&gt;--url&lt;/span&gt; https://yourorg.crm.dynamics.com
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h1&gt;
  
  
  Configure Settings:
&lt;/h1&gt;

&lt;p&gt;1). Within the Project folder, create a builderSettings.json file. &lt;/p&gt;

&lt;p&gt;2). Populate it with the desired configuration. Below is an example configuration:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight yaml"&gt;&lt;code&gt; &lt;span class="pi"&gt;{&lt;/span&gt;
    &lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="s"&gt;entityNamesFilter"&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="pi"&gt;[&lt;/span&gt;&lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="s"&gt;account"&lt;/span&gt;&lt;span class="pi"&gt;,&lt;/span&gt; &lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="s"&gt;contact"&lt;/span&gt;&lt;span class="pi"&gt;],&lt;/span&gt;
    &lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="s"&gt;generateSdkMessages"&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="nv"&gt;true&lt;/span&gt;&lt;span class="pi"&gt;,&lt;/span&gt;
    &lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="s"&gt;namespace"&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="s"&gt;YourNamespace"&lt;/span&gt;&lt;span class="pi"&gt;,&lt;/span&gt;
    &lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="s"&gt;serviceContextName"&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="s"&gt;ServiceContext"&lt;/span&gt;&lt;span class="pi"&gt;,&lt;/span&gt;
    &lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="s"&gt;language"&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="s"&gt;CS"&lt;/span&gt;&lt;span class="pi"&gt;,&lt;/span&gt;
    &lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="s"&gt;generateGlobalOptionSets"&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="nv"&gt;false&lt;/span&gt;&lt;span class="pi"&gt;,&lt;/span&gt;
    &lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="s"&gt;emitFieldsClasses"&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="nv"&gt;false&lt;/span&gt;&lt;span class="pi"&gt;,&lt;/span&gt;
    &lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="s"&gt;emitEntityETC"&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="nv"&gt;false&lt;/span&gt;&lt;span class="pi"&gt;,&lt;/span&gt;
    &lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="s"&gt;emitVirtualAttributes"&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="nv"&gt;false&lt;/span&gt;&lt;span class="pi"&gt;,&lt;/span&gt;
    &lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="s"&gt;logLevel"&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="s"&gt;Off"&lt;/span&gt;&lt;span class="pi"&gt;,&lt;/span&gt;
    &lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="s"&gt;entityTypesFolder"&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="s"&gt;Entities"&lt;/span&gt;&lt;span class="pi"&gt;,&lt;/span&gt;
    &lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="s"&gt;optionSetsTypesFolder"&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="s"&gt;OptionSets"&lt;/span&gt;&lt;span class="pi"&gt;,&lt;/span&gt;
    &lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="s"&gt;messagesTypesFolder"&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="s"&gt;Messages"&lt;/span&gt;
&lt;span class="pi"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;3). Adjust the settings as needed. For a comprehensive list of configuration options, please take a look at the &lt;a href="https://learn.microsoft.com/en-us/power-platform/developer/cli/reference/modelbuilder" rel="noopener noreferrer"&gt;official documentation&lt;/a&gt;. &lt;/p&gt;

&lt;h1&gt;
  
  
  Generate Early-Bound Classes:
&lt;/h1&gt;

&lt;p&gt;1). Open a command prompt and navigate to your project directory.&lt;/p&gt;

&lt;p&gt;2). Execute the following command:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;  pac modelbuilder build &lt;span class="nt"&gt;--settingsTemplateFile&lt;/span&gt; ./builderSettings.json &lt;span class="nt"&gt;--outdirectory&lt;/span&gt; ./Entities
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;3). This command generates the early-bound classes based on your configuration and outputs them to the Entities folder.&lt;/p&gt;

&lt;h2&gt;
  
  
  Run Locally
&lt;/h2&gt;

&lt;p&gt;Clone the project&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;  git clone https://github.com/umargulzar1122/EarlyBound.git
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Go to the project directory&lt;/p&gt;

&lt;p&gt;Open the solution file&lt;/p&gt;

&lt;p&gt;Restore Dependencies&lt;/p&gt;

&lt;h3&gt;
  
  
  Set Startup Project (Visual Studio)
&lt;/h3&gt;

&lt;p&gt;Open EarlyBound.sln&lt;/p&gt;

&lt;p&gt;In Solution Explorer:&lt;/p&gt;

&lt;p&gt;Right-click the D365.Plugins.ConsoleApp Project&lt;/p&gt;

&lt;p&gt;Select "Set as Startup Project"&lt;/p&gt;

&lt;p&gt;Update Connection string App.Config file&lt;/p&gt;

&lt;p&gt;Press F5 to start with debugging&lt;/p&gt;

&lt;p&gt;Or Ctrl+F5 to start without debugging&lt;/p&gt;

&lt;p&gt;&lt;a href="https://learn.microsoft.com/en-us/power-apps/developer/data-platform/org-service/generate-early-bound-classes" rel="noopener noreferrer"&gt;Official Documentation&lt;/a&gt;&lt;/p&gt;

</description>
      <category>dynamics365</category>
      <category>powerapps</category>
      <category>powerplatform</category>
      <category>programming</category>
    </item>
  </channel>
</rss>
