Giorgi / EntityFramework.Exceptions

Strongly typed exceptions for Entity Framework Core. Supports SQLServer, PostgreSQL, SQLite, Oracle and MySql.
https://giorgi.dev/entity-framework/introducing-entityframework-exceptions/
Other
1.44k stars 68 forks source link

Get table name and field name for unique constraint. #44

Closed makingbloke closed 2 years ago

makingbloke commented 2 years ago

When a unique constraint fails is there a way to retrieve the table name and field name (or even the constraint name)? I'm using the latest versions for SQLite and SQL Server with EF Core 6 / .Net 6.

Giorgi commented 2 years ago

For SQL Server the message returned from the database contains the name of the constraint and table but for SQLite, I think it's not included in the error message. Duplicate of #35

janseris commented 2 years ago

@Giorgi also for various DB localizations (language settings) that would be impossible to parse generally to extract table or column name, right?

Giorgi commented 2 years ago

Yes, that's right