C# SQLite+;EntityFramework对在处理上下文后使连接保持活动状态

C# SQLite+;EntityFramework对在处理上下文后使连接保持活动状态,c#,entity-framework,system.data.sqlite,C#,Entity Framework,System.data.sqlite,我正在使用SQLite for.Net和.NETFramework4.0中的EntityFramework。在我从SQLite v.1.0.79.0迁移到v.1.0.86.0之前,一切都很好。从那时起,代码是这样的 using (var context = new EntityContent(sqliteConnectionString)) { context.ExecuteStoreCommand(mySqlScriptString); /* * or do some

我正在使用SQLite for.Net和.NETFramework4.0中的EntityFramework。在我从SQLite v.1.0.79.0迁移到v.1.0.86.0之前,一切都很好。从那时起,代码是这样的

using (var context = new EntityContent(sqliteConnectionString))
{
    context.ExecuteStoreCommand(mySqlScriptString);
    /*
     * or do some stuff with context entities and call context.SaveChanges()
     */
}
deleteSQLiteDbFile(getDbFilePath(sqliteConnectionString)); // <-- here is the error
使用(var context=newentitycontent(sqliteConnectionString))
{
ExecuteStoreCommand(mySqlScriptString);
/*
*或者使用上下文实体执行一些操作并调用context.SaveChanges()
*/
}

deleteSQLiteDbFile(getDbFilePath(sqliteConnectionString));// 出现此问题的原因是System.Data.SQLite中的关闭行为发生了更改,该行为与EF不再兼容。 详情请参阅:

因为这只是在我的集成测试中,所以我使用了这里的解决方法来解决这个问题: