1
Vote

PropertyFilteredPageReferenceSettings not set when using PageTypeBuilder's IUpdatePropertySettings

description

I created the following attribute, it executes and fills the settings correctly, but the FilteredPageReference seems to ignore it.
 
public class FilteredSettingsAttribute : Attribute, IUpdatePropertySettings<FilteredPageReference.PropertyFilteredPageReferenceSettings>
{
    public FilteredSettingsAttribute(params Type[] allowedTypes)
    {
        this.AllowedTypes = allowedTypes;
        this.RestrictToEpiServerPages = true;
    }
 
    void IUpdatePropertySettings<PropertyFilteredPageReferenceSettings>.UpdateSettings(PropertyFilteredPageReferenceSettings settings)
    {
 
    //    Debugger.Break();
        settings.RestrictToEPiServerPages = this.RestrictToEpiServerPages;
        settings.AllowedPageTypesAndInterfaces = this.AllowedTypes;
        if (this.HomePageProperty != null)
        {
            PageData homePage = DataFactory.Instance.GetPage(PageReference.StartPage);
            if (homePage != null)
            {
                PageReference pageRef = homePage[this.HomePageProperty] as PageReference;
                if (!PageReference.IsNullOrEmpty(pageRef))
                {
                    settings.StartFromCurrentSiteStartPage = false;
                    settings.StartFromCurrentPage = false;
                    settings.StartFrom = pageRef;
                }
            }
        }
    }
 
    public Type[] AllowedTypes { get; protected set; }
    public string HomePageProperty { get; set; }
 
    public bool RestrictToEpiServerPages { get; set; }
 
    int IUpdatePropertySettings<PropertyFilteredPageReferenceSettings>.GetSettingsHashCode(PropertyFilteredPageReferenceSettings settings)
    {
        return settings.GetHashCode();
    }
 
    bool IUpdatePropertySettings<PropertyFilteredPageReferenceSettings>.OverWriteExistingSettings
    {
        get { return true; }
    }
}

comments