Last post Jul 28, 2012 02:23 AM by Decker Dong - MSFT
Jul 26, 2012 10: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 11: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 11: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 11:57 AM|christiandev|LINK
yes, why would you want to delete the connection string ?
Jul 27, 2012 07: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 09: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 28, 2012 02:23 AM|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……