Code for updating field taking forever
I have the following code below that is taking a VERY long time to execute. I am monitoring the DB and it does appear to be working, however it is taking a long time! Do you see any issues with the code or a better way to write the code to improve the performance?
DynamicModuleManager dynamicModuleManager = DynamicModuleManager.GetManager();
Type accordianPanelType = TypeResolutionService.ResolveType("Telerik.Sitefinity.DynamicTypes.Model.AccordianPanels.AccordianPanel");
var panels = dynamicModuleManager.GetDataItems(accordianPanelType).Where(p =>
p.Status == ContentLifecycleStatus.Live);;
foreach (DynamicContent panel in panels)
foreach (var ac in panel.AvailableCultures)
if (ac.ToString() != "")
System.Threading.Thread.CurrentThread.CurrentUICulture = ac;
string tabName = panel.GetString("Title");
//Update TabName field
panel.SetValue("TabName", tabName);
//Save Changes
dynamicModuleManager.SaveChanges();
Hello Jared,
What you could optimize is to call SaveChanges only once after all items have been modified, outside the foreach loops. Basically, this is the slowest operation you are executing. However, on what number of items you are executing this?
Regards,
Nikola Zagorchev
Telerik