开发者

Behavior of a controller action on reception of a null dto

When a controller detects that a DTO passed t开发者_如何转开发o it is null should it instantiate an instance of the DTO (cf the Null Object Pattern), or should it simply throw an exception there and then?

Thanks


If null means that you can instantiate a Null Object and act in a default way, it's ok. If null makes any sense to the controller, handle this case. If null makes no sense to the controller, throw an exception.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜