In my .NET porject, I have to run a lot of validation on 4/5 fields. This validation checks if certain fields have errors, for example: the name
field is not allowed to have numbers or symbols. If all these checks are passed, I need to execute a SQL query to pull some data out of the database.
I could have it with a lot of nested IFs, and run the function at the end once it passes them all, but this will translate into about 12 nested IFs, and it seems a really bulky way to do it. I have also thought about setting a boolean value after every check, and if the value is 1
then don't run the function, else do. But of course this gets overwritten by other checks that pass.
Can anyone provide some insight? Thanks.