Why does DynamicModuleManager.GetDataItems(type) return dupl

Posted by Community Admin on 04-Aug-2018 22:42

Why does DynamicModuleManager.GetDataItems(type) return duplicate items?

All Replies

Posted by Community Admin on 06-Mar-2012 00:00

QUESTION:
In Sitefinity 4.4, I created a new custom module with module builder. I entered 4 items, but when I retrieve them with GetDataItems, I get 8 back. Why am I getting a duplicate of each?

DETAILS:
Each item looks like this:

Top Menu Items
-------------------
menuItem (string)
menuBody (long text)
sortOrder (numeric)

I entered 4 items. Only 4. They are simple. I run the following code to retrieve those 4 items in order (based on the sort order), and I get 8 back. Why?

DynamicModuleManager dynamicModuleManager = DynamicModuleManager.GetManager();
 
Type topMenuItemType = TypeResolutionService.ResolveType("Telerik.Sitefinity.DynamicTypes.Model.TopMenus.TopMenuItem");
             
var MenuItems = dynamicModuleManager.GetDataItems(topMenuItemType).OrderBy("menuOrder").AsEnumerable();

Posted by Community Admin on 06-Mar-2012 00:00

Looking into the DynamicContent that was returned, the duplicate items are mostly the same except:

ID is different (off by a minute)
Status is different (one is "Live", and one is "Master")
Visibility is different. (one true, one false)

So I still don't know WHY there is a duplicate, but I will try to filter one out, maybe based on visibility.

Posted by Community Admin on 06-Mar-2012 00:00

If I add the following, it works as intended. (I get 4 results rather than duplicated 8)

.Where("Visible == true")

Posted by Community Admin on 07-Mar-2012 00:00

Hey Dan,
  Live and Master are global content concepts, but yeah this article doesn't really go into detail on the EXACT difference....however one level up there's a detailed description on which is which here

Steve

This thread is closed