We almost always have to validate string data, such as username, email etc. So why not just incorporate the data validation into our data models and generate the code that already knows how to validate data?
OneGen supports validation of
string? data types. The validation
is based on regular expressions.
- Select or create a class
- Select or create a property with
- Click on the validation icon next to the data type field
- Enter a simple validation regex (allowing only alphanumeric characters):
- Enter a message for the user in case validation fails: Only alphanumeric characters are allowed!