// public bool IsSelected { get; set; } public bool HasModel(object model) { if (model == null) { return(false); } var selected = this.ModelVMList.Contains(model.GetType()); model.Match <EntityCommonVM>( ec => { selected = false; if (PageSysName != null) { ec.Entity.Match <SimplePage>( sp => selected = sp.SysName == PageSysName || sp.RootMainParent .GetOrDefault(x => x.SysName) == PageSysName); } }); if (!selected) { selected = Predicates.Aggregate(false, (r, p) => r || p(model)); } return(selected); }