ASP.NET MCV 2, re-use of SQL-Connection string

Posted by cc0 on Stack Overflow See other posts from Stack Overflow or by cc0
Published on 2010-04-23T23:01:54Z Indexed on 2010/04/23 23:03 UTC
Read the original article Hit count: 404

Hi, so I'm very very far from an expert on MVC or ASP.NET. I just want to make a few simple Controllers in C# at the moment, so I have the following question;

Right now I have the connection string used by the controller, -inside- the controller itself. Which is kind of silly when there are multiple controllers using the same string. I'd like to be able to change the connection string in just one place and have it affect all controllers.

Not knowing a lot about asp.net or the 'm' and 'v' part of MVC, what would be the best (and simplest) way of going about accomplishing just this?

I'd appreciate any input on this, examples would be great too.

© Stack Overflow or respective owner

Related posts about asp.net-mvc

Related posts about ASP.NET