Parameter Validation Best Practices

后端 未结 5 2733
一生所求
一生所求 2021-02-20 09:05

Imagine you have an application which is some kind of front-end to all your business logic. This front-end has a lot of DLLs upon which it depends, and the methods in t

5条回答
  •  -上瘾入骨i
    2021-02-20 09:53

    Very interesting topic :)

    in general you should implement a "validation facade" lower than the user interface and at the lowest possible level commonly accessed by user interface and external services.

    you can check for null and validate input also in the UI just to avoid a useless round-trip to the server, client side validation is a good practice, still you cannot trust the caller to only pass you valid values.

提交回复
热议问题