I would like to know what is the best practice to work with C# and SQL Server (entity framework) between the two examples below :
1- open connection each time you want to work with SQL server and close it right after ? (I use entity framework using statement)
2- open connection once and keep it up as long as needed for all the tasks that need to be done even if there is code that doesn't need the SQL connection open to run ? ( I would control the context myself without the using statement in this scenario)
I know this question is not much complicated but I'm still a newbie in the domain of database and programming.
Many thanks for your answers!