Jeff-Lewis / codesmith

Automatically exported from code.google.com/p/codesmith
0 stars 0 forks source link

AddRules is never called for Custom Validation #125

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. Add RulesManager.AddSharedRule in the AddRules partial method of manager
class
2. Execute new RulesManager().Run(myCustomDataContext);
3. Rule does not fire.

What is the expected output? What do you see instead?

I looked in the SharedBusinessRules static property of the RuleManager and
didn't see the CustomOne I added in the AddRules method.

I also put a break point on the AddSharedRule method and the execution of
my delegate I passed.  No break points are ever hit.

Please use labels and text to provide additional information.

Original issue reported on code.google.com by billrob...@gmail.com on 20 Aug 2009 at 9:09

GoogleCodeExporter commented 9 years ago
It seems the static constructor for the manager call never gets fired.  The 
quick
solution I had is to change the CustomDataContext OnCreated to new up the 
Manager. 
This will force the static constructors for all of the XXXManagers to call their
AddRules method.

Perhaps this could be moved to another location because the other Rules are 
added by
default.

Original comment by billrob...@gmail.com on 21 Aug 2009 at 3:34

GoogleCodeExporter commented 9 years ago
Ah, there is a method on the entity 

static partial void AddSharedRules 

to add these rules without relying on the manager classes.

Original comment by billrob...@gmail.com on 27 Aug 2009 at 9:14

GoogleCodeExporter commented 9 years ago

Original comment by ejsm...@gmail.com on 27 Aug 2009 at 10:06