I have seen different implementations of connection strings in controllers.
Some are just as simple as:
public class tableNameController : Controller
{
private ConnectionStringName db = new ConnectionStringName();
...
Others are:
public class tableNameController : Controller
{
private ConnectionStringName db;
public tableNameController()
{
db = new ConnectionStringName();
}
Is there a benefit of putting the connection string in a constructor or just leave it as a private variable?