Set Command Timeout in EF 6

倾然丶 夕夏残阳落幕 提交于 2019-12-17 09:59:20

问题


I want to set command timeout for query execution, currently I am doing context.Database.CommandTimeout = 90; but i feel this is not working, I tried checking the process logs in database but found the time difference was always less than 90sec.

Can someone help how can I set the database timeout in Entity Framework 6?


回答1:


Check this :

Entity Framework 6 :

this.context.Database.CommandTimeout = 180;

Entity Framework 5:

((IObjectContextAdapter)this.context).ObjectContext.CommandTimeout = 180;

Entity Framework 4 and below:

this.context.CommandTimeout = 180;


来源:https://stackoverflow.com/questions/36977974/set-command-timeout-in-ef-6

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!