This project is read-only.

ContentPartDriver updates ContentPart even when the model contains an error

Topics: Administration, Core, General, Troubleshooting, Writing modules
Feb 3, 2015 at 11:47 PM
Edited Feb 3, 2015 at 11:52 PM
Using orchard 1.8.1.

When you call updater.AddModelError() from a ContentPartDriver's Editor() method, it doesn't prevent orchard to update the attached ContentPart in the end of the process (more accurately, the changes are not rolled back). This is very annoying when you need to implement field validation for a ContentPart.

This behavior is observable in a stock Orchard installation, when you update your site settings' super user to a non-existant user, the SiteSettingsPartDriver adds a model error ("The user {0} was not found") but the part is updated anyway (and you end up with a superuser-less website, so test this with caution...).