Using Observablecollection for code generation template

5 posts, 0 answers
  1. Issam
    Issam avatar
    18 posts
    Member since:
    Sep 2008

    Posted 30 Sep 2014 Link to this post

    Hi,

    based on this guideline page
    http://docs.telerik.com/data-access/developers-guide/code-generation/customizing-code-generation/domain-model/data-access-tasks-customise-code-generation-collection-generation

    i changed the code generation template to use ObservableCollection instead of List,
    it work for a simple test , the UI is notified correctly after changes, the bound Count property is shown like excpected ... etc .



    but i am wondering how this will behave when i go further in developpement in term of performance .
    the main question is :
    that this change affect the overall application performance, comparing of using the default List or TrackedBindingList for the navigation properties . ?

    just curious

    thanks and good day !
  2. Kaloyan Nikolov
    Admin
    Kaloyan Nikolov avatar
    118 posts

    Posted 06 Oct 2014 Link to this post

    Hi Issam,

    Unfortunately we don't have detailed performance comparison between List and ObservableCollection/TrackedBindingList when used as navigation property.

    Potential performance degradation you could expect of the external code listening for the collection change events. If you will operate with with relatively large collections I would suggest your rather to re-bind the entire property instead as in the most of the cases this is faster for the UI. I would suggest you to use TrackedBindingList as we have some known issues with ObservableCollection. Also you can limit its usage only for the navigation properties you use for binding to ensure that the performance is not decreased. 

    I hope this helps, should you have any additional questions do not hesitate to get back to us. 

    Regards,
    Kaloyan Nikolov
    Telerik
     
    OpenAccess ORM is now Telerik Data Access. For more information on the new names, please, check out the Telerik Product Map.
     
  3. DevCraft banner
  4. Michael Hafner
    Michael Hafner avatar
    3 posts
    Member since:
    Oct 2008

    Posted 09 Mar 2015 in reply to Kaloyan Nikolov Link to this post

    Kaloyan,
    How would you limit usage to only navigation properties that is used for binding? Is this done somewhere on the EntitesModel.rlinq GUI designer?
    Thanks,

    Michael
  5. Kaloyan Nikolov
    Admin
    Kaloyan Nikolov avatar
    118 posts

    Posted 11 Mar 2015 Link to this post

    Hi Michael,

    Unfortunately there is no way to control this from the designer. If you need to do it you should modify a bit the code generation templates. A possible solution could be to list the full name of the properties that should be generated as TrackedBindingList<T> in a file located close to the code generation templates and then read it from the templates and generate the proper type accordingly. 

    If you have a client side stand alone application usually it should not cause any performance issues to generate TrackedBindingList for each navigation property. You should pay more attention if the same model will be used server side, as there the performance is more crucial and.

    I hope this helps. Should you have any additional questions do not hesitate to get back to us.

    Regards,
    Kaloyan Nikolov
    Telerik
     
    OpenAccess ORM is now Telerik Data Access. For more information on the new names, please, check out the Telerik Product Map.
     
  6. Michael Hafner
    Michael Hafner avatar
    3 posts
    Member since:
    Oct 2008

    Posted 11 Mar 2015 Link to this post

    Yes, it works! Thanks.
Back to Top
DevCraft banner