Query Dynamic Content Module right way ?

Posted by Community Admin on 04-Aug-2018 09:14

Query Dynamic Content Module right way ?

All Replies

Posted by Community Admin on 17-Nov-2014 00:00

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. 

thanks

Posted by Community Admin on 17-Nov-2014 00:00

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.

Posted by Community Admin on 24-Nov-2014 00:00

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
Telerik

 
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
 

This thread is closed