I'm doing a DataBase intensive application, and I came up with some doubts as I am new to ASP.NET
MVC4
C#
:
1) Is it better to Open a connection and keep it open for all the requests? Or to make Open()
and Close()
for each request? (If the first option is the best, when/where do I close the connection??)
2) I come from PHP and I am used to Open a connection on the FrontController
(just at the begining) and close it at the end, so every request opens only one connection, uses it for everything required, and drops it just before serving the HTTP
response. Is that the way to go in ASP.NET
MVC 4
?
3) Any in-code performance tip will be appreciated!! :)