Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- try
- {
- this.Context.Users.Add(user);
- this.Context.SaveChanges();
- }
- catch (DbUpdateException ex)
- {
- var innerException = ex.InnerException.InnerException as SqlException;
- if (innerException.Number == 2627)
- {
- throw new NameAlreadyInUseException(username);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment