Can I just point the connection string in Dbml.designer.cs to the connectionstring in the app.conf? I wrote the code below which it successfully point to the app.config.
public leDataContext() :
base(ConfigurationManager.ConnectionStrings["leConnString"].ToString(), mappingSource)
{
OnCreated();
}
However whenever i modify or add a table into the dbml, it will start to auto replace that code into this
public leDataContext() :
base("Data Source=.\\SQLEXPRESS;AttachDbFilename=\"D:\\My Projects\\App_Data\\le.mdf\";Integrated Security=True;Connect Timeout=30;User Instance=True", mappingSource)
{
OnCreated();
}
I have expanded the “Connection” option. Set “Application Settings” to False
Don’t modify
Dbml.designer.csfile manually, because it will be rewritten when you edit/add a table etc. as you said. Instead of this set theConnectionproperty for the.dbmldesigner file toNoneand add a partial class with parameterless constructor: