The validations we have done so far were configured at model level, and when we say model, it happens within its own domain. We may have a requirement where we need to operate across models. Entity Framework has a provision to achieve the same since it is data driven and the validation required outside the model is not available in Entity Framework. To fill this gap, MVC has a provision to achieve the same using RemoteAttribute
, which allows the user to consume the controller action that follows a certain pattern in the implementation.
The remote validation requires the following boundary conditions:
RemoteAttribute
requires two properties—controller
andaction
- Configured field name should be used as the action parameter name
- The action should return a
Json
data - The returned data must have a
boolean
value
The blogging system has a similar requirement that requires remote validation:
- Validation should be performed without submitting the entire form
- Username can be verified on the...