public override int GetHashCode() { unchecked { return((ViewSpecs.GetHashCode() * 397) ^ ViewLayouts.GetHashCode()); } }
public ViewSpecList Filter(Func <ViewSpec, bool> viewPredicate) { var viewSpecs = ImmutableList.ValueOf(ViewSpecs.Where(viewPredicate)); var viewSpecNames = new HashSet <string>(viewSpecs.Select(viewSpec => viewSpec.Name)); return(new ViewSpecList(viewSpecs, ViewLayouts.Where(layout => viewSpecNames.Contains(layout.ViewName)))); }
public ViewSpecList SaveViewLayouts(ViewLayoutList viewLayoutList) { IEnumerable <ViewLayoutList> newLayouts = ViewLayouts.Where(layout => layout.ViewName != viewLayoutList.ViewName); if (!viewLayoutList.IsEmpty) { newLayouts = new[] { viewLayoutList }.Concat(newLayouts); } return(new ViewSpecList(ViewSpecs, newLayouts)); }
public ViewSpecList ReplaceView(string oldName, ViewSpec newView) { List <ViewSpec> items = new List <ViewSpec>(); bool found = false; foreach (var item in ViewSpecs) { if (item.Name != oldName) { items.Add(item); continue; } found = true; if (newView != null) { items.Add(newView); } } if (!found && null != newView) { items.Add(newView); } IEnumerable <ViewLayoutList> newLayouts; if (oldName != null) { if (newView == null) { newLayouts = ViewLayouts.Where(layout => layout.ViewName != oldName); } else if (newView.Name == oldName) { newLayouts = ViewLayouts; } else { newLayouts = ViewLayouts.Where(layout => layout.ViewName != newView.Name) .Select(layout => layout.ViewName == oldName ? layout.ChangeViewName(newView.Name) : layout); } } else { newLayouts = ViewLayouts; } return(new ViewSpecList(items, newLayouts)); }
public IEnumerable <ViewLayout> AllViewLayouts() { return(ViewLayouts.All()); }
public ViewLayoutList GetViewLayouts(string name) { return(ViewLayouts.FirstOrDefault(layout => layout.ViewName == name) ?? ViewLayoutList.EMPTY.ChangeViewName(name)); }
public override object ConvertFrom(string attributeValue, SerializationContext context) { return(ViewLayouts.ById(attributeValue)); }