Ability to Change Connection String in Designer
Enable the ability to easily change the connection string in the designer. A server name may be changed, or the database may be relocated. Currently, every screen would need to be recreated to accomplish this.
Anyone who votes for this suggestion may want to consider voting for this one:
Ward Durossette commented
I can tell you another use case for this feature. Start a new project, use the "Create new table" to design up your tables/data layout, (using the little flyweight version of SQL Server, then when you are ready, switch the connection string to production cluster SQL Server.
Or, just allow the Create new table to select what server the tables are created in. Don't force me into SQL Express or whatever the marketing name is these days, let me do my table designing on my DEV SQL box out on the network.
I've been searching this topic for hours. I see many asking the same question and the responses appear to be completely off the mark. Many LOB applications have the need to change the connection string of the application's datasource at runtime based on a variety of circumstances. The datasource could be SQL, SharePoint, web services, whatever... The development environment would be pointing to test data. When publishing, the wizard provides the opportunity to change the connection string. But that is NOT what people are asking for. If I have a company that has separate data sources based on region, I don't want to have to deploy the app four times to support four regions. If I can identify the region at runtime, I should be able to override the connection string at runtime and run the application from a single deployment. The datasources in this example would be identical so the entities are not changing. We need a way to change the connection string (web service uri, etc) at run time, not design time or publish time.
I just want to be able to switch databases when the user logs in so that each one gets the database for his own country. The prices, poduct descriptions and tax rates vary from country to country but the database structure is identical. Editing the config file or republishing the app won't help me here unless I have them login to a completely different application. What is the solution for this case?
This is embarrassing to say the least! A product coming from MSFT should not be this poorly designed.
Lou van Dyk commented
This is a must! We have to have an easy way to change the database name / connection string. In "real life" enviornments, database connections change frequently.
Victor Perez commented
Click with the right mouse button on the data source, and then click "Update" data source, so open the window click "previous".
Alkis Balasis commented
I completely agree. I am trying to figure out how to do it now.
I completely agree. I am trying to figure out how to do it now. I have a LightSwitch application that manages a small set of records in one production database on one server. But I need to be able to flip to another database on another server without having to manually edit the .config file. The databases have identical architecture.
For now, I will try to write a little Server-Switcher application that reads the other application's .config file as its data and re-configures the connection string. Messy.
I VOTE FOR a dynamic data source re-configuration capability in running LightSwitch applications.
Andy Kung commented
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.