You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Oct 27, 2020. It is now read-only.
Trevor Pilley edited this page May 20, 2014
·
1 revision
The ValidateModelNotNullAttribute will throw an ArgumentNullException if the model in a request is null, it saves having to write if (model == null) { throw new ArgumentNullException("model"); } at the start of every action.
You may not want the attribute to apply to a certain action, therefore the ValidateModelNotNullAttribute has a SkipValidation property (false by default) which allows you to opt out individual actions.
[ValidateModelNotNull(SkipValidation = true)] // will only affect the action it is applied to
public HttpResponseMessage Edit(int id, Model model) { ... }