I have a class with some getters with fallbacks:
WebPageClass
{
public virtual string Name { get; set; }
public virtual string Title
{
get
{
var title = this.GetPropertyValue(page => page.Title);
return string.IsNullOrWhiteSpace(title) ? Name : title;
}
set
{
this.SetPropertyValue(page => page.Title, value);
}
}
public virtual string ListTitle
{
get
{
var listTitle = this.GetPropertyValue(page => page.ListTitle);
return string.IsNullOrWhiteSpace(listTitle) ? Title : listTitle;
}
set
{
this.SetPropertyValue(page => page.ListTitle, value);
}
}
}
My issue is when I try to get ListTitle for an object where ListTitle and Title are null. It tries to fall back to Title, but it never enters the getter for Title, it just returns null.
I also tried using this.GetPropertyValue to retrieve the fallback-value, but it made no difference.
I would expect it to enter the getter when I try to get the property, but is this intended behavior? or should i use some other way to access the fallback-property?