Skip to content

How to get/inject services in custom ValidationAttributes #23305

Answered by lfrancke
lfrancke asked this question in General
Discussion options

You must be logged in to vote

For anyone stumbling across this later: A colleague asked the same question on StackOverflow and received an answer here: https://stackoverflow.com/questions/62559817/how-to-get-inject-services-in-custom-validationattributes

Short version is: Subscribe to the OnFieldChanged event of the Form's EditContext instead.

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@lfrancke
Comment options

Answer selected by lfrancke
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
1 participant