Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Can deadlock priority be set in Entity Framework?

Is there a way to set the SQL deadlock priority in Entity Framework without having to open each connection explicitly and issue a SQL command to set the deadlock priority on that specific connection before using it?

Using explicit connections everywhere and issuing a SQL deadlock priority command is the only way I've found so far, which is a bit of a pain.

I'm currently working with Entity Framework versions 5 & 6 in different applications.

The purpose is to set deadlock priority low in automated applications (which can recover / retry on their own) so they don't interfere with user applications while any deadlock issues are being resolved.

Note: this question is not about tracking down or preventing deadlocks in Entity Framework - that's another topic well handled elsewhere here.

like image 476
Chuck Bevitt Avatar asked Nov 09 '22 22:11

Chuck Bevitt


1 Answers

You can set the deadlock by running an explicit SQL statement/command or by running a stored procedure. This can also work on transaction isolation level or query hints. See https://msdn.microsoft.com/en-us/library/dn456843%28v=vs.113%29.aspx?f=255&MSPPError=-2147217396

like image 196
DiskJunky Avatar answered Jan 04 '23 03:01

DiskJunky