问题描述
我正在为xamarin项目使用实体框架。当该应用在iOS上最小化然后再次打开时,它将引发连接问题(请参见下面的错误):
SNIX_Execute(提供者:SNI_PN7,错误:35-SNI_ERROR_35)
I'm using entity framework for a xamarin project. When the app is minimised on iOS and then opened again it throws connection problems (See error below):SNIX_Execute (provider: SNI_PN7, error: 35 - SNI_ERROR_35)
我发现解决此问题的唯一方法是在连接字符串中将pooling设置为false。
The only way I've found to solve this is to set pooling to false in the connection string.
我想在xamarin的OnSleep()方法中手动清除连接池。
I want to clear the connection pool manually in the OnSleep() method in xamarin. Is there anyway to clear Entity Framework's connection pool?
推荐答案
更新-刚刚找到了解决方法。在简历方法中添加:
Update - Just found out how to do it. On the resume method in add:
SqlConnection.ClearAllPools();
这篇关于实体框架-如何手动清除连接池? SNIX_Excecute错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!