Is it acceptable to keep a db connection open for the life of the page?

前端 未结 10 1944
执念已碎
执念已碎 2021-01-18 07:11

Everybody knows that you should close a connection immediately after you finish using it.

Due to a flaw in my domain object model design, I\'ve had to leave the conn

10条回答
  •  北荒
    北荒 (楼主)
    2021-01-18 07:47

    I think a better question with much more informed and productive feedback would be possibly providing some snippets of what you're doing (code) and expanding on the reasons why you've made this choice. There is most likely a better solution that doesn't require keeping the connection open so long, but at least, for pragmatic reasons, you could get some feedback on whether it's worth revamping.

    In future, you definitely want to move away from data access in your code-behind.

提交回复
热议问题