Validation Rules and Fetch

Validation Rules and Fetch

Old forum URL: forums.lhotka.net/forums/t/6542.aspx


DivisibleByZero posted on Monday, March 02, 2009

Are validation rules supposed to fire upon fetching an object or do we assume that since the object is in the database then it is already valid?

JohnB replied on Monday, March 02, 2009

This was discussed a few days ago. Check it out here.

http://forums.lhotka.net/forums/thread/28784.aspx

JoeFallon1 replied on Tuesday, March 03, 2009

DivisibleByZero:
Are validation rules supposed to fire upon fetching an object or do we assume that since the object is in the database then it is already valid?

It is your call. Many years ago I adopted the rule to not trust the database either so I always run CheckRules when I fetch a BO. You never know what 3rd party apps and tools are modifying data directly in a database table. Many other devs do this too so I am not unique in this regard.

The framework does *not* make the call for you on Fetch (I think it does on Create but I 'd have to check ) so you have to decide if you want to do it for none, some or all BOs.

Joe

 

 

Copyright (c) Marimer LLC