I have a Users table, which has a Unique constraint on the username (for obvious reasons).
I am using an EF 4.0 DAL to populate the database, and in the process of coding the CreateUser() method.
Is it...
- Best to catch the SqlException thrown if I try to insert a username which already exist.
- Explicitly check for the username before I try to insert it to the database?
If you could also give reasons as to why, that would be great!