Last post Jul 27, 2012 09:23 PM by Decker Dong - MSFT
Jul 26, 2012 05:00 AM|ravi010mittal|LINK
I am working with ASp.NET using Entity Framework, currently i am getting ConnectionString from App.Config and
Web.Config file. now i create a base class which returns me the ConnectionString when i required that means i do not required
App.Config and Web.Config ConnectionStrings, but when i delete ConnectionStrings from Web.Config file it gives me an error when getting data from database.
Please left me know how to remove that ConnectionStrings from Web.Config and
Jul 26, 2012 06:24 AM|christiandev|LINK
You will need the connection string in web.config, since your calling the EF project from your website.
Jul 26, 2012 06:48 AM|ravi010mittal|LINK
thanks for reply
you mean to say i m not able to delete that ConnectionString from Web.Config file...
Jul 26, 2012 06:57 AM|christiandev|LINK
yes, why would you want to delete the connection string ?
Jul 27, 2012 02:08 AM|ravi010mittal|LINK
because i need to apply connectionString at RunTime.....User select database at RealTime....and ConnectionString bulid after selection
Jul 27, 2012 04:56 AM|christiandev|LINK
When you create your context object, is it just a parameter-less constructor in your website?
var contect = new DbContext();
if so, you should be able to replace that call with a connection string.
var context = new DbContext(connString);
Jul 27, 2012 09:23 PM|Decker Dong - MSFT|LINK
you don't need to remove connection string from App.config or Web.config, but just set the constructor's connection string as a string parameter……