DatabaseFactory and ClickOnce deployment

Topics: Data Access Application Block
Feb 15, 2008 at 11:09 PM
Ex Web guy here trying to write my first windows app. .NET 3.5, VS2008, Enterprise Library 3.1, latest version of SQL Server CE

I have a working CAB app that gets data via a (SQL CE) Database object created with DatabaseFactory.CreateDatabase.

When using this method, a connectionString name must be provided (or a default one declared) in the app.config file.

The app is being deployed via ClickOnce.

Since this is an occasionally connected app the CE database lives on the device.

My problem is that ClickOnce puts the app in a user specific location, so I don't know what the path is to the database file. The app.config file is read-only, so I can't modify it at runtime.

How do I code the connection string definition in app.config to tell the Factory to look for the file in the running application directory?