In examples of interacting with the database in ASP.NET I always see
using ( SqlConnection con = new SqlConnection(ConfigurationManager.ConnectionStrings["MyDatabase"].ConnectionString) )
{
// ... Do some stuff
}
but I'm wondering, shouldn't I just be connected all the time? It doesn't make sense why I would want all the overhead involved in opening and closing connections. Shouldn't con
be like a static
member of my model?