public CategoryCached(Category category) { Id = category.Id; Name = category.Name; NameNormalized = category.NameNormalized; Token = category.Token ?? category.Name.ToLower(); AppendTokenToSubCatsPath = category.AppendTokenToSubCatsPath; ShowInBreadcrumbs = category.ShowInBreadcrumbs; Title = category.Title; IsMaterialsContainer = category.IsMaterialsContainer; SubTitle = category.SubTitle; Icon = category.Icon; Header = category.Header; IsMaterialsNameEditable = category.IsMaterialsNameEditable; IsMaterialsSubTitleEditable = category.IsMaterialsSubTitleEditable; SettingsJson = SunJson.MakeJElement(category.SettingsJson); ParentId = category.ParentId; SortNumber = category.SortNumber; LayoutName = category.LayoutName; IsHidden = category.IsHidden; IsCacheContent = category.IsCacheContent; _subCategories = new List <CategoryCached>(); _allSubCategories = new List <CategoryCached>(); }
public SectionClientCached(Section section, Dictionary <string, Type> clientComponentTypes, IRolesCache rolesCache) { Id = section.Id; Name = section.Name; Type = section.Type; if (section.Roles != null) { Roles = section.Roles.Split(',') .Select(x => rolesCache.GetRole(x)) .ToDictionary(x => x.Id, x => x) .ToImmutableDictionary(); } else { Roles = new Dictionary <int, RoleCached>().ToImmutableDictionary(); } if (clientComponentTypes.TryGetValue(Type, out Type type)) { object clientData = JsonSerializer.Deserialize(section.Options, type); string clientJson = JsonSerializer.Serialize(clientData); Options = SunJson.MakeJElement(clientJson); } }
public ComponentClientCached(Component component, IReadOnlyDictionary <int, RoleCached> roles) { Id = component.Id; Name = component.Name; Type = component.Type; Settings = SunJson.MakeJElement(component.ClientSettingsJson); Roles = roles; }
public MenuItemCached(MenuItem menuItem, IReadOnlyDictionary <int, RoleCached> roles) { Id = menuItem.Id; ParentId = menuItem.ParentId; Name = menuItem.Name; Title = menuItem.Title; SubTitle = menuItem.SubTitle; RouteName = menuItem.RouteName; Exact = menuItem.Exact; CssClass = menuItem.CssClass; ExternalUrl = menuItem.ExternalUrl; IsSeparator = menuItem.IsSeparator; SortNumber = menuItem.SortNumber; Icon = menuItem.Icon; IsHidden = menuItem.IsHidden; RouteParamsJson = SunJson.MakeJElement(menuItem.RouteParamsJson); SettingsJson = SunJson.MakeJElement(menuItem.SettingsJson); Roles = roles; }