当我像这样创建一个简单的 EntityFramework 连接时
Private Function ConnectEF() As ObjectContext
Dim context1 As EstFarmacologicaEntities = New EstFarmacologicaEntities(tools.connectionstring("EstFarmacologica"))
Return contexto1
End Function
然后我调用objectcontext ...
Public Function ListGroupFarma() As Ilist
Dim context2 As EstFarmacologicaEntities = ConnectEF()
Dim listFarma As IList = (From ... Where .. Select ...).ToList()
context2.Dispose()
Return listFarma
End Function
是否有必要处置 context1?就像使用'SqlConnection.Close'时......我的意思是Context1或其连接将保留在内存中?我该如何检查?