Validation rule for a WriteOnly propertyValidation rule for a WriteOnly property
Old forum URL: forums.lhotka.net/forums/t/3950.aspx
bgilbert posted on Wednesday, November 28, 2007
I have a WriteOnly property with a validation rule. However, it seems that the Validation rule code cannot access this property's value with out a get.
My use case is that this is a password property. In the Set, I encrypt the password. The field is a byte array, but the property is a string. I'd prefer not to expose the string version to the class's interface.
Any thoughts on validation on a write-only property?
RockfordLhotka replied on Wednesday, November 28, 2007
You'll probably need to do the validation at the field level. Use reflection to get the field, or put your rule method in your class and then you can access the field directly.bgilbert replied on Wednesday, November 28, 2007
Rocky,
Thanks. What I was missing was the fact that my rule method was in another class. Moving it into the calling class will work great.
Copyright (c) Marimer LLC