Virtual Happy Hour this month, Jun 28, we'll be getting a sneak preview at our soon to launch SaaS CMS!

Try our conversational search powered by Generative AI!

How to convert block property types with MigrationSteps?


Hello everyone,

the question was already asked here:

i actually want to do exactly the same, convert an existing string property in a page to XhtmlString. So i want to use MigrationSteps.

Unfortunately there is nowhere an example on how to do it. This is the documentation:

It lacks sample code(apart from renaming a property which you find everywhere in the internet) that shows how to convert the type.

As a workaround i have tried to do it with another property even if that pollutes my class and needs a lot of work to fix it everywhere:

	Name = "Title",
	Description = "Article title",
	Order = 999)]
[Obsolete("Replaced with the XhtmlString property ArticleTitle")]
public virtual string Title { get; set; }

	Name = "Title",
	Description = "Article title",
	Order = 220)]
public virtual XhtmlString ArticleTitle
		XhtmlString articleTitle = this.GetPropertyValue(page => page.ArticleTitle);
		return articleTitle ?? new XhtmlString(this.GetPropertyValue(page => page.Title));
	set { this.SetPropertyValue(page => page.ArticleTitle, value); }

One issue i have with this is that the old Title is correctly returned but it's not visible in CMS. So the CMS-Editor thinks it is empty. How to fix that? Another minor one is that the order of the new property that should replace the old is ordered last, so not at the same position even if i gave it the same Order value. I really would prefer MigrationSteps(or a similar programmatic approach) if possible because we have several systems apart from production that need to be maintained.

Thanks in advance,


Edited, Jan 08, 2021 15:34
* 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.