November Happy Hour will be moved to Thursday December 5th.

Property value is saving as null or empty contentRepository.Save()

Vote:
 

I have a property named "SiteName" under a pagetype as shown below.

[Display(
Name = "Name",
GroupName = "EPiServerCMS_SettingsPanel")]
[BackingType(typeof(PropertyLongString))]
[CultureSpecific(false)]
public virtual string SiteName { get; set; }

The above property overrides the inbuilt PageName property (see below) and it is working as expected.

[Ignore]
public override object this[string index]
{
get
{
if (index == "PageName")
{
return SiteName;
}
return base[index];
}
set { base[index] = value; }
}

The issue is when I am trying to update the "SiteName" property. It seems its saving null/empty values atleast thats what its showing in CMS. I tried clearing cache,iisreset and what not. I havent digged into the database yet though. Below is my update code.

var pageData = m_cmsTreeStructureScanner.Get(ContentReference.RootPage);
var allPages = m_cmsTreeStructureScanner.GetChildren(pageData.PageLink);
foreach (var page in allPages)
{
var brandPage = (BrandingSettingsPageType)page.CreateWritableClone();
brandPage.SiteName = brandPage.PageName;
s_logger.Debug("Saving the brandpage - brandpagename : "+brandPage.Name+ ", brandpageid :"+brandPage.PageLink.ID);
m_contentRepository.Save(brandPage, SaveAction.Publish, AccessLevel.NoAccess);
}

I can see the brandpage.SiteName has the value in the Save method. There is no exceptions thrown anywhere. All the logs look good as well.

Can someone please assist? Will really appreciate any inputs /thoughts you may have

#176013
Mar 07, 2017 16:47
* You are NOT allowed to include any hyperlinks in the post because your account hasn't associated to your company. User profile should be updated.