I have a collection, each object in it has validation setup as AddInstanceBusinessRules or AddBusinessRules. I don't want the object to be validated if its a load, is there any way I can prevent the validation through CSLA methods available during load........ Yes I can check if its a load or not but i don't want to hit the AddInstanceBusinessRules or AddBusinessRules methos at-all during load.
You can't avoid having AddInstanceBusinessRules() called for each instance - if you don't want per-instance rules then don't override this method.
The AddBusinessRules() method is called once per appdomain, not once per object. So it is not called on every object you create.
The actual checking of rules is caused by a call to ValidationRules.CheckRules(). If you don't want the rules checked when your object is created/loaded then don't call this method in the DataPortal_XYZ method.
In CSLA .NET 3.5 there's a protected SuppressRuleChecking property you can set to true to stop CheckRules() from doing any work. This is designed to allow you to create batch load scenarios for an object, where you set a whole bunch of properties and then manually call CheckRules() at the end of the process. I don't think this is useful for your scenario, but I thought I'd mention it just in case.
Copyright (c) Marimer LLC