More in this section

Forums / Developing with Sitefinity / Query Dynamic Content Module right way ?

Query Dynamic Content Module right way ?

3 posts, 0 answered
  1. Aseven7
    Aseven7 avatar
    15 posts
    16 Mar 2014
    17 Nov 2014
    Link to this post
    Maybe this is very basic question, i have 1 dynamic module and with several custom  fields such name short text, country related data. Usually i do query :

    manager.GetDataItems(typeOfContent).Where(c => c.GetRelatedData<DynamicContent>("country").Where(ct => ct.GetValue<string>("Title").Contains("france"));

    it will returning error because iqueryable not ready yet fetching custom field content.

    But when i do cast to enumerable it work, fine but quite make page load more slow : 

    manager.GetDataItems(typeOfContent).AsEnumerable().Where(c => c.GetRelatedData<DynamicContent>("country").Where(ct => ct.GetValue<string>("Title").Contains("france"));

    any people have same issue like me ? any suggestion for query with my above conditions to optimizing my content loading. 

  2. Arno
    Arno avatar
    249 posts
    08 Sep 2010
    17 Nov 2014 in reply to Aseven7
    Link to this post
    In general I can say that LINQ often does not work well with Sitefinity if the query is a bit more complex (e.g. when filtering on properties like in your case or when joining queries). Unfortunately I cast to Enumerable or List all the time. A bug fix request related to LINQ joins can be found here.
  3. Junior Dominguez
    Junior Dominguez avatar
    115 posts
    15 Sep 2017
    24 Nov 2014
    Link to this post
    Hi Antony,

    We believe this is an issue related to a bug we have logged in our feedback portal. For now we recommend to continue using for now the second alternative you mentioned (casting to Enumerable).

    You can subscribe to the notifications of this bug report by clicking on the button "Like" to keep updated about the resolution of this issue.

    Best Regards,
    Junior Dominguez
    Do you want to have your say in the Sitefinity development roadmap? Do you want to know when a feature you requested is added or when a bug fixed? Explore the Telerik Sitefinity CMS Ideas&Feedback Portal and vote to affect the priority of the items
3 posts, 0 answered