Skip to main content

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

Required fields*

4
  • Interesting you'd say classes should not be concerned with validation. Data Annotation on properties in C# used for validation, is out of the box behaviour no? Commented Apr 28, 2019 at 16:13
  • @niico I said no such thing, I only said that it should not be in that class. It should be in a separate class that specialized in that concern. Commented Apr 29, 2019 at 13:39
  • So in essence are you saying validation should be in ViewModels, assuming the OP's model is a Model not a ViewModel? Commented Apr 30, 2019 at 14:05
  • 1
    @niico essentially. I am not saying all validation should be in the view model, but basic for input validation like this, it makes sense. Also, if this validation is needed multiple times, it could also go in an intermediate class. Commented Apr 30, 2019 at 14:50