Overrides sub AddBusinessRules is not executed. Please help

Overrides sub AddBusinessRules is not executed. Please help

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


davidng posted on Thursday, August 05, 2010

Hi everyone,

In Project Tracker application, for object Project,  procedure AddBusinessRules is automatically executed.

However, in my application this procedure is not executed at all. I set breakpoint inside the procedure, but it is not executed.

Below is my code excerpt. Please advice. Thank you very much in advance.

--------------

Protected Overrides Sub AddBusinessRules()

AddSharedCommonRules()
AddSharedCustomRules()

MyBase.AddBusinessRules()

 

End Sub

xAvailx replied on Thursday, August 05, 2010

Where are you in the stack when you are trying to see this behavior?

For example, you won't see this during a Fetch by default or in the Create if you override that method. 

davidng replied on Friday, August 06, 2010

In Project Tracker application, it happens when opening existing project (ie, Edit project - select a project - click OK)

In my application, I follow the same logic as project tracker, but AddBusinessRules not executed.

Are there any "pre-requirements" for this to work?

Thanks.

 

 

RockfordLhotka replied on Friday, August 06, 2010

AddBusinessRules() is called exactly once per type per appdomain. So the first time any of your code interacts with the rules subsystem for a specific type that'll cause that type's rules to be initialized and cached.

Normally this is triggered by a CheckRules() call - which in turn is normally triggered by a SetProperty() call in a property.

Copyright (c) Marimer LLC