The Tag data class, i.e. the one that is linked to the database, a number of validation rules, including one that is checked inside the EF SaveChanges.
Property | Validation rule | Where shown? | Where Checked* |
---|---|---|---|
Name | Must not be empty | By property | Browser,MVC,EF |
Name | Must not be longer than 128 characters | By property | Browser,MVC,EF |
Name | Must not contain HTML symbols, e.g. <, > | Exception | MVC |
Slug | Must not be empty | By property | Browser,MVC,EF |
Slug | Must not be longer than 128 characters | By property | Browser,MVC,EF |
Slug | Must not be empty | By property | Browser,MVC,EF |
Slug | Must not contain spaces or non-alphanumeric characters | By property | MVC,EF |
Slug | Must be unique, i.e. must not exist in any other tag entry in the database | By property | SaveChanges |
Note*: The 'Where Checked' terms are
if (!ModelState.IsValid)
in Controller actionsThe test for HTML symbols is done by MVC and throws an exception, which in the release version goes to the default error page.