public IEnumerable<WidgetType> LoadWidgetTypes() { if (controlTypes == null || controlTypes.Count <= 0) { controlTypes = new List<WidgetType>(); var conFiles = fileProvider.GetFiles("Widgets/*", "*.cshtml", false) .Union(fileProvider.GetFiles("Widgets", "*.cshtml", false)); var moduleFiles = fileProvider.GetFiles("Modules/*/Widgets/*", "*.cshtml", false) .Union(fileProvider.GetFiles("Modules/*/Widgets", "*.cshtml", false)); conFiles.ForEach(f => { WidgetType tt = new WidgetType(); tt.Name = f.FileNameWithoutExtension(); tt.Path = "~/" + fileProvider.MakeRelative(f.FullName); tt.Category = f.Directory.Name.ToLower() == "widgets" ? "" : f.Directory.Name; tt.Parameters = GetParameters(f.FullName); controlTypes.Add(tt); }); moduleFiles.ForEach(f => { WidgetType tt = new WidgetType(); tt.Name = f.FileNameWithoutExtension(); tt.Path = "~/" + fileProvider.MakeRelative(f.FullName); tt.Category = f.Directory.Name.ToLower() == "widgets" ? "" : f.Directory.Name; tt.Module = f.Directory.Name.ToLower() == "widgets" ? f.Directory.Parent.Name : f.Directory.Parent.Parent.Name; tt.Parameters = GetParameters(f.FullName); controlTypes.Add(tt); }); } return controlTypes; }