Button/Job to re-interpret types in code and re-build in the database/cms


I've had a few instances when I've changed the type of an page or object property and episerver doesn't pick up the change. It would be great if there was an action that could be initiated from the admin section that would drop the database types and re-build them from code.

I had a class extending another class, that was being used as a property type, and changed the property from SuperClass to SubClass and got this error message:

Unable to cast object of type 'Castle.Proxies.BaseListingBlockProxy' to type 'SRA.Web.Models.Blocks.BaseBlocks.NoPagingBaseListingBlock'

To fix this error I renamed the property, I replaced ALL guid's in ALL related types, re-build, restarted IIS, restarted my PC, nothing reset the database to correctly reflect the types in code. Eventually I created a second property of the new type and worked with it from there. Only solution i could get working.

I understand how powerful the feature is that doesn't immediately drop the database version of each type it finds in code that is different, but during development it would have saved me many many hours of bug fixing if this was a feature, as this is not the first time this has happened, and it's not always immediately obvious that that is what the problem is

Apr 29, 2019 12:59

For development environment you should be able to go into the editor and CMS->Admin->Content Type, drop your page/property definition there and it will be rebuilt from code on the next boot-up.

If multiple environments are afflicted there are APIs for doing migrations for these definition changes but it is too much a hassle for a single dev env.

Apr 29, 2019 17:29