MVC, DbContext and Multithreading

前端 未结 2 683
悲&欢浪女
悲&欢浪女 2020-12-19 14:22

There are lots of questions about these subjects separately and everyone have their own opinion. Maybe someone can give me a good answer regarding the following issue.

2条回答
  •  星月不相逢
    2020-12-19 14:26

    The DbContext is a very light object and it is designed to be created for each operation (=request) and then disposed. Under the hood ado.net takes care of reusing db connection from connection pool.

提交回复
热议问题