Should Entity Framework Context be Put into Using Statement?

前端 未结 9 1695
不思量自难忘°
不思量自难忘° 2020-11-29 23:52

The Entity Framework context object implements a Dispose() method which \"Releases the resources used by the object context\". What does it do really? Could it be a bad thin

9条回答
  •  情歌与酒
    2020-11-30 00:15

    I have noticed (although in only one application) that the explicit disposal was causing thread abort exceptions in mscorlib which are caught before the application code, but at least in my case resulting in a noticeable performance hit. Haven't done any significant research on the issue, but probably something worth consideration if you are doing this. Just watch your DEBUG output to see if you are getting the same result.

提交回复
热议问题