AsyncRuleHandler & IsNewOld forum URL: forums.lhotka.net/forums/t/8127.aspx
opedog posted on Friday, December 11, 2009
Morning, as part of a business rule I'm trying to write, I need to check 2 things:
- IsNew == true, and
- if a certain key already exists in the DB
The server call is easy, just a simple AsyncRuleHandler, but I don't seem to have a way to check IsNew (since you can't add an AsyncRuleHandler as an instance validation rule.)
RockfordLhotka replied on Friday, December 11, 2009
When you call AddRule() to add an async rule method to a property, there's an optional overload of AddRule() where you can pass an array of other properties that should be provided to the rule method.
The array is of IPropertyInfo objects - and there's no IPropertyInfo for IsNew... But you can add one to your class - it shouldn't cause any issue since it is just metadata - and then you'd be able to have the rules subsystem provide the IsNew value to your rule method.
opedog replied on Monday, December 14, 2009I am kicking myself for not thinking of that... Thanks, Rocky!
Copyright (c) Marimer LLC