5

please how do i change the connection string of a lightswitch application for debugging purposes . i have followed this post http://dougseven.com/2010/08/23/data-storage-in-visual-studio-lightswitch-2/

but i can seem to get it to work. anytime i change the web.config in the applicationroot/bin/debug when i run the application in debug mode the file gets recreated with the original value in the file.

i have no problem changing it when publishing the app.

and when i implement the change in the applicationdefinition.lsml file it has no effect

Fabiyi Tunde
  • 53
  • 1
  • 3

2 Answers2

2

From Andy Kung lightswitch team:

If you attach to an external datasource, you can right click on that node in the Solution Explorer and select "Update Datasource" to modify the server info without recreating your screens.

EDITED

... but is not true.

You should change applicationroot/ServerGenerated/Web.config instead applicationroot/bin/debug/web.config.

Explanation:

If you turn to File View, in Data/ApplicationDefinition.lslm they are a reference to your connection string:

Then in project\ServerGenerated\Web.config locate the connection string:

<connectionStrings>
    <add name="_IntrinsicData" ... />
    <add name="e8f0cfed-653d-42fc-9617-bcaee11eed91" connectionString="HERE!!!!!!
dani herrera
  • 48,760
  • 8
  • 117
  • 177
  • thanks a million i changed it in the servergenerated web config. – Fabiyi Tunde Nov 10 '12 at 08:54
  • we are actually using tfs to develop in a team and every one has a copy of the database schema locally thats why i actually wanted to change the connection string. would want to see the effect of [check in] and [retrieve latest version[ on this file will it overwrite this location again – Fabiyi Tunde Nov 10 '12 at 08:58
1

A little late but just in case... If you right-click the datasource then select "Update Datasource" then WAIT for the connection to fail (if the original server is not available) then hit 'Back' you be taken to the connection settings. Just update the connection settings and continue as normal.

Alan Schofield
  • 19,839
  • 3
  • 22
  • 35