4

If some of my models have dynamic validation conditions (i.e. the string length can be minimum of 8 or 12 depending on a database value or some other dynamic value) is it impossible to use data annotation for validation?

From what I understand, the values of any parameter (example StringLength min/max value) have to be truly static. Are there alternatives for applications that have dynamic validation values?

2
  • If the validation changes through time your DataBase Data may not valid after sometime is it a good idea ? Commented Jan 23, 2010 at 6:14
  • @ali62b - I can safely assume it will always be valid since only administrators will have access to these values. Commented Jan 23, 2010 at 14:57

1 Answer 1

3

Your pretty much stuck with writing your own custom validationattribute:

http://msdn.microsoft.com/en-us/library/system.componentmodel.dataannotations.validationattribute.aspx

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.