Esempio n. 1
0
        public bool IsMatch(IModel data, string key)
        {
            bool result = false;

            if (data is IPage)
            {
                var contentData = data as IPage;
                // if there are no view model keys defined on this model AND the page template does not specifically require a view model key, we will try to match on the page template title
                if ((ViewModelKeys == null || ViewModelKeys.Count() == 0) && string.IsNullOrEmpty(key))
                {
                    if (!string.IsNullOrEmpty(TemplateTitle))
                    {
                        return(contentData.PageTemplate.Title.ToLower() == TemplateTitle.ToLower());
                    }
                }
                result = ViewModelKeys.Any(x => x.Equals(key, StringComparison.OrdinalIgnoreCase));
            }
            return(result);
        }
Esempio n. 2
0
 public override int GetHashCode()
 {
     return((ViewModelKeys != null ? ViewModelKeys.GetHashCode() : 0) * 37 + SchemaRootElementName.GetHashCode());
 }