locked
Dynamic Entity???????? RRS feed

  • Question

  • Hi everyone,

     

    I am really confused about using Dynamic Entity?? According to CRM SDK i know meaning of Dynamic Entity...........But thats only Bookish Knowledge..............

     

    Can Someone really tell me when to use Dynamic Entity??? If you can give some example than it would be helpfull for me.......


    Believe in yourself!!!!!!!!!!!!
    Monday, November 1, 2010 2:51 PM

Answers

  • A dynamic entity just represents a CRM entity and can have one or more properties (e.g. CRMNumber, CRM Boolean, etc..),

    It provides the ability to not have to use strongly typed business objects like Account with all of its properties.

    There is a lot more to this, like when to use, but really your going to get more from reading the SDK. I prefer to use them instead of typed objects because you do not need to worry if an entity changes in the future, you don't have to rebuild your web references and so forth.


    MSCRM Bing'd - http://bingsoft.wordpress.com
    Check out the CRM 4 to CRM 2011 JavaScript Converter Tool
    CRM Forum Guidance on how to Help Us Help You
    Monday, November 1, 2010 3:06 PM
    Moderator
  • Dynamic Entity is uses late Binding.

    Without Dynamic Entity, you have to add web reference of CRM webservices to your project. This will download the definition of CRM entities in XML format to your project. This is called typed entities. In your project, you will do something like

    Account acc = new Account();

    acc.Name= "Xyz";

    acc.AccountNumber = "12345";

    Only problem with this method is if you add any new attribute to your entity in CRM after the adding the web reference to your project, it will not show up in your entity definition. like if you add new attribute "new_address1".

    it won't appear like "acc.new_address1 "

    If you want newly added attribute to appear in your project you have to update the web reference every time you add new attribute. That's the problem.

    However if you use DynamicEntity here are the advantage:

    1. You don't need to add web reference, you can use Microsoft.Crm.Sdk.dll & Microsoft.Crm.SdkProxy.dll

    2. You won't have to worry newly added attribute. Because you won't add values to attribute name rather you will add values by types and assign attribute names to it.

    Here is how your will do it.

    <br/>
    DynamicEntity myDE = new DynamicEntity();<br/>
    myDE.Name = “Installment”;<br/>
    <br/>
    StringProperty name = new StringProperty(); // specifying the attribute type<br/>
    name.Name = "new_name";//if the name of primary attribute is new_name<br/>
    name.Value = "Name of Dynamic Entity";<br/>
    <br/>
    myDE.Properties.Add(name);<br/>
    <br/>
    myService.Create(myDE);
    

    So you will do the late binding of your attribute so don't need to worry about newly added attribute

    here are few links other than CRM SDK

    http://blogs.infinite-x.net/2008/08/01/working-with-dynamic-entities-in-crm-40/

    http://nishantrana.wordpress.com/2008/10/29/understanding-dynamicentity-in-microsoft-dynamic-crm/

    https://community.dynamics.com/product/crm/crmtechnical/b/billoncrm/archive/2008/08/04/working-with-dynamic-entities-in-crm-4-0.aspx

    Let me know if you need more details..

     


    Jai Ho CRM http://mscrmkb.blogspot.com Skype - amol.gholap

    Mark as answer if a post has answered the question
    Monday, November 1, 2010 3:31 PM

All replies

  • A dynamic entity just represents a CRM entity and can have one or more properties (e.g. CRMNumber, CRM Boolean, etc..),

    It provides the ability to not have to use strongly typed business objects like Account with all of its properties.

    There is a lot more to this, like when to use, but really your going to get more from reading the SDK. I prefer to use them instead of typed objects because you do not need to worry if an entity changes in the future, you don't have to rebuild your web references and so forth.


    MSCRM Bing'd - http://bingsoft.wordpress.com
    Check out the CRM 4 to CRM 2011 JavaScript Converter Tool
    CRM Forum Guidance on how to Help Us Help You
    Monday, November 1, 2010 3:06 PM
    Moderator
  • Dynamic Entity is uses late Binding.

    Without Dynamic Entity, you have to add web reference of CRM webservices to your project. This will download the definition of CRM entities in XML format to your project. This is called typed entities. In your project, you will do something like

    Account acc = new Account();

    acc.Name= "Xyz";

    acc.AccountNumber = "12345";

    Only problem with this method is if you add any new attribute to your entity in CRM after the adding the web reference to your project, it will not show up in your entity definition. like if you add new attribute "new_address1".

    it won't appear like "acc.new_address1 "

    If you want newly added attribute to appear in your project you have to update the web reference every time you add new attribute. That's the problem.

    However if you use DynamicEntity here are the advantage:

    1. You don't need to add web reference, you can use Microsoft.Crm.Sdk.dll & Microsoft.Crm.SdkProxy.dll

    2. You won't have to worry newly added attribute. Because you won't add values to attribute name rather you will add values by types and assign attribute names to it.

    Here is how your will do it.

    <br/>
    DynamicEntity myDE = new DynamicEntity();<br/>
    myDE.Name = “Installment”;<br/>
    <br/>
    StringProperty name = new StringProperty(); // specifying the attribute type<br/>
    name.Name = "new_name";//if the name of primary attribute is new_name<br/>
    name.Value = "Name of Dynamic Entity";<br/>
    <br/>
    myDE.Properties.Add(name);<br/>
    <br/>
    myService.Create(myDE);
    

    So you will do the late binding of your attribute so don't need to worry about newly added attribute

    here are few links other than CRM SDK

    http://blogs.infinite-x.net/2008/08/01/working-with-dynamic-entities-in-crm-40/

    http://nishantrana.wordpress.com/2008/10/29/understanding-dynamicentity-in-microsoft-dynamic-crm/

    https://community.dynamics.com/product/crm/crmtechnical/b/billoncrm/archive/2008/08/04/working-with-dynamic-entities-in-crm-4-0.aspx

    Let me know if you need more details..

     


    Jai Ho CRM http://mscrmkb.blogspot.com Skype - amol.gholap

    Mark as answer if a post has answered the question
    Monday, November 1, 2010 3:31 PM
  • Hi Vedrine,

    Dynamic Entity Concept is used when you want faster access like you have some Custom Entity. You can't access it through through SDK without using dynamic entity...And we go for Dynamic Entity Concept for better performance also for creating attributes.....

     

     

    Monday, November 1, 2010 4:23 PM
  • Hi Kumar/Alok/Clinton,

     

     

    The Definition is really well explained. Keep it up......Thanks


    Believe in yourself!!!!!!!!!!!!
    Monday, November 1, 2010 4:33 PM