Suppress specific validation rule

Suppress specific validation rule

Old forum URL:

dro posted on Monday, May 28, 2012

Hi, I was wondering if there is a way to suppress a specific validation rule when calling ICheckRules.CheckRules? 

I have a Name property on an object, and it has 2 rules registered to it: a Required rule, and an async NameUnique rule, which checks in the database if the name already exists. 

Since in the UI the Name field is updated on PropertyChanged, I don't want the server to be called on each key pressed. So I would like to check the unique name only when the user saves and I call CheckRules explicitely. 

Is there a way to do this? 

JonnyBee replied on Monday, May 28, 2012

Add the NameUniqueRule as an Object rule (ie PrimaryProperty = null) will make the rule run only when CheckRules or <bo>.CheckObjectRules is called.

An object level rule can add Error/Warn/Info messages to any property in the object.

Copyright (c) Marimer LLC