Page 1 of 1

Linq to SQL and PostgreSql Profiler

Posted: Thu 10 Nov 2011 15:45
by Lucas Phillip
Greetings all!

I'm trying to run a insert a bunch of data into postgresql using linq to sql but i'm getting a "foreign key restriction". And I can't figure out what's wrong because the exception code does not show me anything usefull (like, which row is bugging).

Is there a way for me to profile linq to sql execution, in order to see a little more about the error?

Thanks

Posted: Fri 11 Nov 2011 18:00
by StanislavK
For example, you can check the SQL generated for your commands. For the detailed information about this, please refer to the 'Monitoring' topic of our documentation:
http://www.devart.com/linqconnect/docs/Monitoring.html

This error may occur, e.g., if a foreign key is nullable, whereas the corresponding property in the model is not. In this case, new rows may be inserted with default (e.g., zero instead of null) values in the foreign key columns, leading to the constraint violation.