v-wywang
4/14/2008 5:47:00 AM
Hello Chuck,
Thanks for your reply.
Making change in designer.cs file doesn't help. VS IDE will re-create
designer.cs file after you modified .dbml.
The connection string gets used in default datacontext constructor varies
according to the connection property in dbml file in designer.
Application setting property in Connection indicates if the connection
string is stored in Application Settings or hard coded in DBML file.
- For Website application, the application setting is stored in web.config
file.
- For Winform/Library application, the application setting is stored in
app.config file.
VS IDE generates the default Datacontext constructor in designer.cs file as
below, if you specified "Application Setting" to "False".
public DataClasses1DataContext() :
base("Data Source=.\\;Initial Catalog=testDB;Integrated Security=True",
mappingSource)
{OnCreated();}
And, the following code is VS IDE generated when "Application Setting" is
"true".
public DataClassesDataContext() :
base(global::System.Configuration.ConfigurationManager.ConnectionStrings["te
stDBConnectionString"].ConnectionString, mappingSource)
{OnCreated();}
If you set the "Application Setting" property in Connection as "True", the
value you changed in web.config file of the connection string will take
effect.
On the other side, you have to modify the connection in DBML file directly,
if "Application Setting" is false.
Please feel free to let us know if you have any more concern or there is
anything unclear. We are glad to assist you.
Have a great day,
Best regards,
Wen Yuan
Microsoft Online Community Support
Delighting our customers is our #1 priority. We welcome your comments and
suggestions about how we can improve the support we provide to you. Please
feel free to let my manager know what you think of the level of service
provided. You can send feedback directly to my manager at:
msdnmg@microsoft.com.
==================================================
This posting is provided "AS IS" with no warranties, and confers no rights.