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*

11
  • Sorry, you can't avoid some duplication. Or don't validate anything on the client, but typically user experience dictates some validation be done on the client. Commented May 16, 2017 at 15:50
  • 1
    see my answer here softwareengineering.stackexchange.com/questions/332314/… Commented May 16, 2017 at 16:33
  • @JonRaynor I feel you miss understood my problem, I am not talking about client side validation. Both are performed on server side, but in different projects. See my edit. Commented May 16, 2017 at 16:48
  • @Ewan I am not sure how your answer solves my problem. In Core class library I throw an exception if DTO is invalid, but it still needs to perform whole validation process in order to complete operation in manager successfully. If you are talking about solution 3., I want to provide GUI with similar error handling as ModelState errors. So user is informed about all errors in the input. Commented May 16, 2017 at 16:52
  • 1
    ...exceptions should be used for unexpected behavior. -- Exceptions should be used for conditions that you cannot automatically recover from. If a user presents you with invalid data that prevents an operation from occurring, that's an exceptional condition. Commented May 16, 2017 at 19:46