LINQ To SQL ignore unique constraint exception and continue
- by Martin
I have a single table in a database called Users
Users
------
ID (PK, Identity)
Username (Unique Index)
I have setup a unique index on the Username table to prevent duplicates. I am then enumerating through a collection and creating a new user in the database for each item.
What I want to do is just insert a new user and ignore the exception…