Do I need to force a Dispose after a LINQ query?

前端 未结 6 1944
野趣味
野趣味 2021-02-12 22:49

My DBA says that there are way too many connection open and he thinks it is my code in .net that is leaving them open.

I am using LINQ querys and EF code first.

6条回答
  •  日久生厌
    2021-02-12 23:13

    The entity framework uses, as far as i know, connection pooling by default to reduce the overhead of creating new connections everytime. Are the connections closed when you close your application?

    If so, you could try to decrease the Max Pool Size in your connection string or disable connection pooling entirely. See here for a reference of possible options in your connection string.

提交回复
热议问题