Comments (8)
Do all the DB Providers that this library supports contain all that information? I can't find it for SqlException
. Haven't checked others
from entityframework.exceptions.
I can't find it for
SqlException
.
Right, SqlException
doesn't have such properties, but it has needed values in a message:
Cannot insert duplicate key row in object 'dbo.MyTable' with unique index 'UQ_MyTable_ColumnNameOrElse'. The duplicate key value is (duplicatevalue).
The statement has been terminated.
This package could try to extract these values from a message (or elsewhere) and just have corresponding properties nullable if not all providers have them in an exception.
Another option would be to store that info in a Data property (no key = no value provided by the exception) and TryGet..
methods, but this is less favorable option.
from entityframework.exceptions.
@STeeL835 Message is not reliable because it is different based on the language of the database server.
from entityframework.exceptions.
@Giorgi You're right.. Well, it could be a "preview" feature, that doesn't guarantee the values (nullable properties still fit) - at least something.
Maybe SqlServerExceptionProcessorStateManager
could have a configurable option to modify parsing template if server's language id isn't 1033? We can't check it from exception programmatically - that would need to be checked by users, but we can still check if template fits the actual exception message and log a warning (like "Exception details could not be parsed from a message. If current locale isn't English, template can be modified there.")
from entityframework.exceptions.
Given that it won't work in all cases even for SqlServer, the value added by those properties will be very low while the number of cases it won't work will be very high.
In my opinion parsing of error messages generated by different databases in different languages should be a separate project and not part of this library.
from entityframework.exceptions.
Still don't understand, why not. People with providers that support these properties will be happy, people with providers like SqlServer
will be able to use a workaround easily (assuming that if you know which DB you're working with, you know its language), and people with none of the options won't lose anything. This lib shouldn't parse all languages of course, but at least could give a tool for it (or an interface for other tools), since it already does the work of intercepting DbUpdateException
s.
from entityframework.exceptions.
@STeeL835 Which database providers report the constraints/tables that caused the error?
from entityframework.exceptions.
@STeeL835 Which database providers report the constraints/tables that caused the error?
For example NpgSql, like in the OP's example. Don't know about the others, though
from entityframework.exceptions.
Related Issues (20)
- Cannot use extension optionsBuilder.UseExceptionProcessor() HOT 9
- Support for the CosmosDB provider HOT 1
- Get Exception returns all DB context entries, which cause huge log file. and vulnerable to add modified, added data HOT 1
- How can one use UseExceptionProcessor in code targetting multiple databases? HOT 2
- Get table name and field name for unique constraint. HOT 3
- Consider separate common logic package from specific implementation database package HOT 1
- Possible issue in Sqlite unique constraint error handling HOT 11
- Strong-named assembly HOT 1
- [Question] how to suppress log messages from EF-Core HOT 4
- The certificate chain was issued by an authority that is not trusted. HOT 6
- racker
- MaxLengthExceededException not being thrown when using SQL Server 2019 HOT 4
- Support for NET 7 HOT 2
- PooledDbContext HOT 3
- Trusted certificate issue when package installed but not used HOT 2
- Using library with AddDbContextPool HOT 3
- Code vulnerabilities in old SqlClient package HOT 4
- EntityFrameworkCore.Exceptions.SqlServer has breaking change released as revision HOT 1
- What's the corresponding Exception in this framework for Microsoft.EntityFrameworkCore.DbUpdateConcurrencyException HOT 1
- NuGet restore issue to do missing dependent package HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from entityframework.exceptions.