Skip to main content
deleted 1 characters in body; edited title
Source Link
John Saunders
  • 161.9k
  • 26
  • 252
  • 403

C# - Entity framework, duplicate unique Duplicate key exception from Entity Framework?

I'm trying to catch the exception throwenthrown when I insert a already existing user with the given username into my database. As the title says then I'm using EF. The only exception thats throwenthat's thrown when I try to insert the user into to db is a "UpdateException" - How can I extract this exception to identify whether its a duplicate exception or something else?

C# - Entity framework, duplicate unique exception?

I'm trying to catch the exception throwen when I insert a already existing user with the given username into my database. As the title says then I'm using EF. The only exception thats throwen when I try to insert the user into to db is a "UpdateException" - How can I extract this exception to identify whether its a duplicate exception or something else?

Duplicate key exception from Entity Framework?

I'm trying to catch the exception thrown when I insert a already existing user with the given username into my database. As the title says then I'm using EF. The only exception that's thrown when I try to insert the user into to db is a "UpdateException" - How can I extract this exception to identify whether its a duplicate exception or something else?

Source Link
ebb
  • 9.4k
  • 18
  • 75
  • 125

C# - Entity framework, duplicate unique exception?

I'm trying to catch the exception throwen when I insert a already existing user with the given username into my database. As the title says then I'm using EF. The only exception thats throwen when I try to insert the user into to db is a "UpdateException" - How can I extract this exception to identify whether its a duplicate exception or something else?