I want to use class annotations to validate a razor form that collects data for properties of a third party’s library class which I cant edit.
Of course I could just make a copy of the class and place the validation annotations on that but this would be ugly and difficult to maintain.
What do people consider best practice for this?
You could use FluentValidation.NET instead of data annotations. It allows you to define validation rules in a separate file. It also allows you to define complex validation scenarios which would be difficult to achieve using the data annotations declarative approach.