I have LINQ to SQL that sometimes throws
"Cannot insert duplicate key string in object 'dbo.Table' with unique index 'IX_Indexname`. The application was terminated.
Is there any way to enable logging, or at least debug in the datacontext, to find out that sql will execute when the error occurs?
Update: I would say that I know about the GetChangeSet() method, I was wondering if there is a property in the DataContext that shows the last SQL that was executed, or a property on sql exception that shows SQL.
The odd thing about this error is that there is only one update in the change sets, and the only field that changes is the datetime field, which is not in the index causing the error.
Glenn slaven
source share